3 ms·
JavaScript also has much better scoping--Python's using = for both defining and setting variables makes life much more difficult.
by tikhonj 14y ago
JavaScript also has much better scoping--Python's using = for both defining and setting variables makes life much more difficult.
- masklinn 14y ago> 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.
- tikhonj 14y agoThat'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.
- hiddenbayes 14y agoAdding 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/003968.html http://mail.python.org/pipermail/python-3000/2006-October/00...