A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039424.html below:

[Python-Dev] closure semantics

[Python-Dev] closure semanticsDelaney, Timothy C (Timothy) tdelaney at avaya.com
Fri Oct 24 02:25:52 EDT 2003
> From: Greg Ewing [mailto:greg at cosc.canterbury.ac.nz]
> 
> > It would break any unadorned 'global x' in a nested scope 
> if the name
> > did not exist anywhere.
> > 
> > One option would be to have an "if the name doesn't exist, it it
> > created in module scope".
> 
> What would be wrong with that? It's what I had in mind.

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.

My understanding of 'outer' is (and I'm not sure about this):

    outer <name>

    Binds and uses <name> in the innermost scope containing the current
    scope that already has <name> bound. If <name> is not bound in any
    containing scope then it is bound into the scope of the current
    module if <name> is used or bound while executing in the current
    scope.

    <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>

Or something like that.

Tim Delaney

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4