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

> The end result is that the syntax and implementation compromises of your language don't really matter much.

Hm. To me that's pretty much all that matters. I want powerful features and a nice syntax.

> Python doesn't have lexical closures like Perl's

What does that mean? Doesn't Python have lexical closures?



Python has closures but has issues when changing variables within them. This leads most people to agree that Python's implementation of closures is insufficient.

See the following link for an example and more details:

http://mail.python.org/pipermail/python-list/2004-July/27095...

Instead of list boxing, you can also use a function attribute to handle changing the variable in the correct scope.


Python's closures are basically read-only in the 2.x series. 3.0 will offer read-write access via the nonlocal keyword: http://www.python.org/dev/peps/pep-3104/

It still won't be exactly the same, because Perl uses `my $foo` once to declare its lexicals; Python will require `nonlocal foo` declarations in all scopes that will use `foo`. The final result is the same, though: using variables from outer scopes.




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

Search: