Python 1.6 The balanced language

Just van Rossum just at letterror.com
Sat Sep 2 11:55:40 EDT 2000


Grant Griffin wrote:
> 
> lobozc at my-deja.com wrote:
> >
> ...
> > 3) My particular favourite is Icon (see www.cs.arizona.edu/icon).
> > Particular aspects of some interest to Python would be goal-directed
> > evaluation [saves helluva lot of lines of code...] and, less
> > importantly, generators and coexpressions. I have no idea how difficult
> > it would be to move these ideas to Python. But I (and many other
> > people) can vouch that these mechanisms are very effective in writing
> > very 'large' programs in a surprisingly small number of lines. I must
> > stress here that this happens not the way Perl does it - but rather
> > like in functional languages. That is: because of the built in
> > mechanisms of evaluation. So it is readable :-), not just terse.
> 
> Speaking as an experienced programmer who has no idea what all that
> schtuff is, I personally hope Python continues to do without it.

I have no idea what "goal-directed evaluation" is, but generators
and co-routines are pretty straightforward. They're not any harder
to understand and use than threads. Co-routines are in fact a lot
like threads, except that context switching is explicit. One
co-routine simply tells another one "ok, now *you* continue, while
I get some rest". The best thing about them is that you can pass a
value from one co-routine to the other when you switch. In terms of
threads: if you have two threads working together, but one is
always just waiting for the other to deliver something, you really
have two co-routines. Except that when you'd write that using
actual co-routines, you minimize two things: context switching
overhead (almost zero with a proper co-routine implementation) and
thread synchronization overhead (say, the overhead of a queue
object). Your code will look cleaner while it will be faster at the
same time.

And of course, Stackless Python makes it possible..

Just



More information about the Python-list mailing list