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

Jim Fulton
Thu, 20 Jan 2000 11:48:18 -0500

Guido van Rossum wrote:
> > I've suggested this to Guido in the past.  His
> > reasonable response is that this would be too big a
> > change for Python 1. Maybe this is something to consider
> > for Python 2?
> Note: from now on the new name for Python 2 is Python 3000. :-)

I like it. 

> > The basic idea (borrowed from Smalltalk) is to have a kind
> > of dictionary that is a collection of "association"
> > objects.  An association object is simply a pairing of a
> > name with a value. Association objects can be shared among
> > multiple namespaces.
> 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.

How so? It doesn't change the mapping semantics.
> There's also the huge change in semantics, as you point out;
> currently,
>         from foo import bar
> has the same effect (on bar anyway) as
>         import foo
>         bar =           # i.e. copying an object reference
>         del foo
> while under your proposal it would be more akin to changing all
> references to bar to become references to
> Of course that's what the moral equivalent of "from ... import ..."
> does in most other languages anyway, so we might consider this for
> Python 3000;

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

> 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.

> (Not to mention brain

It makes my brain feel much better. :)

> and book breakage. :-)

Hey, all of the books will have to be rewritten for Python 3000.


Jim Fulton 
Technical Director   (888) 344-4332              Python Powered!
Digital Creations

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for