Guido van Rossum wrote:

Why is "call expr" a more enticing syntax than "yield *expr" ?

I was thinking it would read better when you're
using generators as lightweight threads, and you
want the one-level-deep nature of generators to
be hidden as much as possible.

The fact that yielding is going on is not of
interest in that situation -- it's just an
implementation detail. What you really want to
express is calling another function, but without
losing your status of coroutine-ness.

Another way of thinking about it is that it
allows you to abstract out a chunk of code from
a generator that contains a 'yield' and put it
into another function, and then call it in
a way that resembles an ordinary function call
as closely as possible.

Maybe 'call' isn't the best word for that, but
I haven't thought of anything better so far.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to