On Tue, 10 Oct 2006, Fredrik Lundh wrote: > Nick Coghlan wrote: > > Any proposal such as this also needs to addresses all of the *other* name > > binding statements in Python: > > > > try/except > > for loop > > with statement > > def statement > > class statement > + import statement > + list comprehension (in 2.X)
The only sane proposal i've seen that consistently addresses all these cases, doesn't create new ambiguous situations, and doesn't break most existing Python code is the "nonlocal" declaration. nonlocal x means "Don't make a new binding for x in the local scope." With this declaration, any binding statements modify the x that is visible from an outer scope instead of creating a local x. -- ?!ng _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com