[Python-ideas] Tweaking closures and lexical scoping to include the function being defined
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Sep 27 02:03:30 CEST 2011
Nick Coghlan wrote:
> My proposed syntax is just a way to explicitly create new entries in
> that middle category - variables with local visibility and nonlocal
> lifetime.
I don't think that's the right way to characterise default
argument values. While the *values* have nonlocal lifetime,
the *name* being declared is a parameter, so both its scope
and lifetime are local. Your proposal would be creating a
new category of name that doesn't currently exist.
I don't see how your proposal would do anything to clarify
the distinction between visibility and lifetime. Currently,
'nonlocal' always refers to visibility. Your way, it would
sometimes mean visibility and sometimes lifetime, with only
a very obtuse clue as to the difference.
--
Greg
More information about the Python-ideas
mailing list