PEP 255: Simple Generators

Gordon McMillan gmcm at hypernet.com
Sun Jun 24 21:58:59 EDT 2001


Glyph Lefkowitz wrote:

>[generators] will hinder the future
>implementation of microthreads should they happen and probably cause some
>pretty fruity interoperability issues (if it's a syntax feature).

Disagree completely. Generators are a pale shadow of what you can
do with Stackless, but one of the issues about Stackless is acceptance.
People trained in structured or OO (without exposure to languages
that have these strange control flow features) tend to think of it
as silliness (much the way you dismiss generators). And, actually, I
think that's the main reason that people are interested in microthreads
instead of coroutines - it follows a familiar model. I'm not dissing
microthreads (they certainly have many uses), but for much of what 
I've seen microthreads used for, coroutines would be more efficient 
and cleaner.

So generators are an important step in getting people to see that
there are other forms of control flow.

The other main issues are Jython compatibility and implementation
complexity (dealing with interpreter recursions). Christian payed no
attention to the former, and only handled a couple cases of the latter.
That's certainly no criticism of Christian - it's a measure of how
difficult the task is (it took a genius to give us a usable 
proof-of-concept).

- Gordon



More information about the Python-list mailing list