Hacker News new | ask | show | jobs
by micheles 6072 days ago
Python 3 has read-write closures. Check out the nonlocal declaration.
1 comments

The nonlocal statement causes the listed identifiers to refer to previously bound variables in the nearest enclosing scope. [1]

While certainly a big improvement, we still can't access variables in arbitrary scopes, just local, nearest non-local, and global. To me, this seems a significantly more complex way of specifying variable scope than just declaring it explicitly.

1. http://docs.python.org/dev/3.0/reference/simple_stmts.html#t...