
June 18, 2011
11:22 p.m.
On Sat, Jun 18, 2011 at 1:04 AM, Jacob Holm <jh@improva.dk> wrote:
A consequence of this would be that you could optionally allow "nonlocal" to bind global names when there are no suitable nonlocal names to bind to (e.g. in a top-level function). It has always slightly bothered me that you couldn't do that, because it makes it harder to move code between levels.
I will say that I was surprised to discover that `nonlocal` can be used only for outer function locals and not for globals, since the name "nonlocal" seems very general, as if it encompassed all things not local. If it could be changed, I think it would be a little more intuitive. In addition, as you mention, it's slightly better for refactoring.