3 ms·
Python 3 has read-write closures. Check out the nonlocal declaration.
by micheles 17y ago
Python 3 has read-write closures. Check out the nonlocal
declaration.
- andreyf 17y agoThe 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#the-nonlocal-statement http://docs.python.org/dev/3.0/reference/simple_stmts.html#t...