News for hackers. Stuff that matters.
Re:Python vs Clojure by mr_dbr on Wednesday October 14, 2009 @06:02PM (#882242)
The whole sentence regarding an if blocks (lack of) scope seems.. wrong.

> .. since y has never been declared in that given scope. I don't quite know how Pythonists handle this, but I can imagine many situations where this will be the cause of much confusion

Given the following code:

    if some_irrelevant_function():
        x = 2
    else:
        x = 5

    print x
The author is claiming it would be less surprising for that to raise a NameError exception, complaining x is undefined?

> To resolve it you have to manually call 'del y'

No. You just have to be sane with the usage of your variables. I have never run into a situation where this has been a problem.

> I don't have the numbers for Python, but I can't count the number of C app's that have suffered from memory-leaks and what not, based on the lack of automated garbage collection. With Pythons use of scope, I imagine quite a few bugs will follow.

Err, no.

----

> Now in one Python doc I found they actually refer to this type of data [dictionary] as immutable

Assuming the docs actually say this, they are incorrect and should be amended.. Dictionaries are absolutely mutable.

> Lambda

Err. The complaint here is you cannot use "?" in an identifier...?

> To Pythons credit it actually pinpointed the exact character which caused the exception - You shouldn't except that much help from Clojures backtraces....yet

Not to make this into a "languageX vs languageY" debate, but I'd say having decent error messages is far preferable to being able to use symbols in an identifiers name..

There are no comments on this comment yet.