Generators versus Coroutines

Antoon Pardon apardon at forel.vub.ac.be
Wed Aug 18 13:44:24 CEST 2004


Op 2004-08-18, Michael Sparks schreef <zathras at thwackety.com>:
> On 17 Aug 2004, Bryan Olson wrote:
> ...
>> Have you been badly bitten by an evil co-routine?
>
> You appear to misunderstand what I was saying. I was not saying
> co-routines are bad. I was saying that generators are, in my experience,
> almost as effective. This isn't attacking anything. It's saying that
> generators really aren't as bad as it appears some people make out.
>
> As for network servers, it looks like the network server system based on
> using generators to gain most of the benefits of co-routines I briefly
> talked about (in one of the lightning talks) at EuroPython has been
> blocked for release as open source :-(
>
> Your arguments in favour of co-routines for servers all hold (IME) for
> generators as well. There is _slight_ extra obfuscation, but nowhere near
> the level of change required for event processing.
>
> NB. The reason I like generators is because they allow me to do
> co-routine-type things in python with no addons. The reason I like
> greenlets is because it seems to go much, much, much further along
> that route _and_ gives a performance boost. Also, I'm not opposed to
> co-routines being added to the language *if* it was done in a manner
> that doesn't confuse new users,

Why should that be a requirement? IMO there is a lot in python
that can confuse new users, so it doesn't make sense to require
that something added to the language shouldn't.

-- 
Antoon Pardon



More information about the Python-list mailing list