Typed Python?

David Bolen db3l at fitlinxx.com
Wed Jul 7 16:55:11 CEST 2004


Jacek Generowicz <jacek.generowicz at cern.ch> writes:

> The ambiguity in Python is abouth whether 'x=10' creates a new
> binding, or rebinds an existing name. Before lexical scopes this was
> disambiguated with the 'global' keyword. Now, that's not enough any
> more.

Isn't it?  Binding is still always local unless you use the global
keyword, it's just lookups that walk the scope hierarchy after lexical
scoping was added to Python.  In fact, there's currently no way (that
I can think of - well, maybe with mucking with frames manually) to
rebind a name in an intermediate scope.  That could in fact be
considered a wart in the nested scope support (PEP 227 indicates Guido
was opposed to it), but it does maintain the unambiguous nature of
name binding.

-- David



More information about the Python-list mailing list