Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

JavaScript also has much better scoping--Python's using = for both defining and setting variables makes life much more difficult.


> JavaScript also has much better scoping

Though I generally agree, that's as long as you mandate linting. JS's implicit globals are even worse than Python's implicit scoping.


That's fair. My editor marks those for me automatically, so they're much less of an issue for me, but they are still really stupid.

On the other hand, you can work around that particularly stupidity just by being careful. Working around the Python limitations requires either something hacky like using a one-element list instead of a variable or (only in 3, I think) a rather ugly "nonlocal" statement at the top of your scope.


Adding a "var" keyword, similar to that of Javascript, was discussed on the Python mailing list a while ago. See here:

http://mail.python.org/pipermail/python-3000/2006-October/00...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: