Talin wrote:

> One thing I don't understand in this discussion of re-purposing the 
> 'global' keyword is how you handle the case of an inner function that 
> *creates* a global.
> 
> Right now, you can create a global variable from within a scope, even if 
> that variable hasn't been declared yet:
> 
>     def foo():
>        global x
>        x = 1
> 
>     foo()
>     print x
> 
> However, if 'global' is simply a synonym for 'nonlocal', then how does 
> it know *which* scope to create the variable in?

since what's a free variable and not is determined by static analysis, 
and free variables are "owned" by the innermost scope they're used in, 
I'm not sure why you even asking that question.

</F>

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to