[Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Aug 24 19:58:32 EDT 2017


Barry Warsaw wrote:
> I actually
> think Python’s scoping rules are fairly easy to grasp,

The problem is that the word "scope", as generally used in
relation to programming languages, has to do with visibility
of names. A variable is "in scope" at a particular point in the
code if you can acccess it just by writing its name there.
The things we're talking about are never "in scope" in that
sense.

What we have is something similar to a dynamic scope, but
a special action is required to access bindings in it. I can't
think of any established term for things like that.

The closest I'ves seen is one dialect of Scheme that called
it a "fluid environment". In that dialect, fluid-let didn't
create bindings in the normal scope, and you had to use
specific functions to access them.

-- 
Greg


More information about the Python-Dev mailing list