[Python-Dev] closure semantics
Greg Ewing
greg at cosc.canterbury.ac.nz
Sat Oct 25 18:22:38 EDT 2003
> It's complex. Can you explain the complete semantics of 'outer' as simply as:
>
> global <name> [in <scope>]
>
> Binds and uses <name> in another scope. If 'in <scope>' is omitted
> then the name is bound and used in the scope of the current module.
global <name>
Assignments to <name> rebind it in the next outer scope where it is
already bound, or in the module scope if there is no existing binding.
Seems about the same length as yours.
> <include warnings about introducing the name into a scope between the
> current scope and the scope where the programmer was expecting the
> name to be bound>
Such comments belong in warning messages about the change issued
during the transitional phase, not in the language definition.
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list