Q: Python 2.0 preliminary features?

Neel Krishnaswami neelk at brick.cswv.com
Sat Oct 9 17:59:29 EDT 1999


On Fri, 08 Oct 1999 20:29:30 GMT, Preston Landers 
<prestonlanders at my-deja.com> wrote:
>
>I'm not really asking about the implementation but the language
>itself; any interesting changes ahead?

Yes, Python 2.0 will be Perfect(tm). :) Other than that, only Guido 
knows for sure. 

Some of the more common requests are:

o Elimination of the class/C-type dichotomy. C extension types (like
  dictionaries and lists) should be real Python classes. 

o Lexical scoping, a la Scheme. 

o Optional type anotations, in order to enable more compile-time type
  checking, and to (possibly) allow faster native Python code. (I'm
  dubious about the latter working, though.)

o A better-designed iteration protocol.

There are some other features that are less frequently requested but
may happen simply because there are people actually willing to sit
down and implement them. (These might even make 1.6, for all I know.)

o List comprehension syntax, a la Haskell. In fact, Greg Ewing has 
  already implemented this as a patch.

o First-class continuations, a la Scheme. This might make it in
  just to permit coroutines and exceptions with restarts. Look at
  Christian Tismer's Stackless Python for the current state.

>And just because I like to start flame wars, I'll go ahead and add my
>own feature to the wishlist:  nested scopes / namespaces.  Is this a
>pipe dream, or just too hard to implement given the internal structure
>of Python (which I'm not really familiar with.)  Maybe I'm just going
>about it all wrong, but it seems like much of my code would be cleaner
>given arbitrarily nested scopes.  I've discussed this with people
>before on c.l.python but never really got an explanation that made
>sense (to me) for the way it is now.

The basic reason that Python does not currently support lexical
scoping is because Python uses a reference-counting garbage-collection
scheme, which can't eliminate cyclic trash, and lexical closures tend
to create a lot of it.

Since the reference-counting scheme is woven fairly deeply into
Python, this is why lexically nested namespaces won't be seen in any
Python 1.x, and why people keep pushing garbage-collection is a
priority for Python 2.0. 

If you are desperate for it now, you should look at Neil Schemenauer's
patch to get the Python interpreter to use the Boehm garbage collector,
and add in Greg Ewing's lexical scoping patch. That should get you 75% 
of what you want. (The remaining 25% requires some syntactic changes to
Python, in order to allow nested local namespaces to shadow properly.
Talk to John Max Skaller about Viper to see what his sense of the 
problem and what the potential solutions are.)


Neel




More information about the Python-list mailing list