[Python-3000] Draft PEP for outer scopes

Ka-Ping Yee python at zesty.ca
Thu Nov 2 21:34:24 CET 2006


On Thu, 2 Nov 2006, Fredrik Lundh wrote:
> Talin wrote:
>
> > If you change the behavior of 'global' to be the same as 'nonlocal' as
> > has been proposed, then this effectively becomes impossible - you can no
> > longer set any global that hasn't already been pre-declared.
>
> of course you can, as long as it isn't shadowed in an intermediate scope.

I think the reason you wouldn't be able to create new globals is that
Guido wants this to be an error (for good reasons IMHO):

    http://mail.python.org/pipermail/python-dev/2006-July/066968.html

|   Perhaps the best solution would be to make it an error if there
|   wasn't a visible variable named a in an outer scope.


-- ?!ng


More information about the Python-3000 mailing list