[Python-Dev] Re: Re: closure semantics

Terry Reedy tjreedy at udel.edu
Fri Oct 24 13:16:41 EDT 2003


"Terry Reedy" <tjreedy at udel.edu> wrote in message
news:bnbm8s$p6h$1 at sea.gmane.org...
>
> But what about name mismatches?  Global statements allows functions
to
> create 'new' variables in the module scope and not just 'existing'
> ones.  What about for in-between scopes?
>
> #start of fress interpreter session
> def f():
>   global xf
>   xf = 1
>   def g()
>     global xg
>     xg = 2
>     global xgf in f
>     xgf = 3
>
> does this compile and run?  or choke on third global at compile
time?
> or choke on third assignment at runtime?

Whoops.
Paul Moore asked same question and Guido answered compile and run.

TJR






More information about the Python-Dev mailing list