Python 2 namespace change? (was Re: [Python-Dev] Changing existing class instances)

Guido van Rossum guido@CNRI.Reston.VA.US
Thu, 20 Jan 2000 12:20:33 -0500


[me]
> > I've never liked this very much, mostly because it breaks simplicity:
> > the idea that a namespace is a mapping from names to values
> > (e.g. {"limit": 100, "doit": <function...>, ...}) is beautifully
> > simple, while the idea of inserting an extra level of indirection, no
> > matter how powerful, is much murkier.

[Jim F]
> How so? It doesn't change the mapping semantics.

My assumption is that in your version, the dictionary would contain
special <object binding> objects which then would contain the
referenced objects.  E.g. {"limit": <binding: 100>, "doit": <binding:
<function ...>>}.  Thus, d["limit"] would be that <binding> object,
while previously it would return 100.

> Again, it would also make function global variable access
> faster and cleaner in some ways.

But I have other plans for that (if the optional static typing stuff
ever gets implemented).

> > however it would break a considerable amount of old code,
> > I think. 
> 
> Really? I wonder. I bet it would break alot less old
> code that other recent changes.

Oh?  Name some changes that broke a lot of code?

--Guido van Rossum (home page: http://www.python.org/~guido/)