On Thu, Apr 30, 2015 at 3:32 PM, Guido van Rossum <gu...@python.org> wrote:

(me:)
>> A badly worded attempt to say
>> Normal generator:  yield (as opposed to return) means
>> that the function isn't done, and there may be more
>> things to return later.

>> but an asynchronous (PEP492) coroutine is primarily saying:

>>      "This might take a while, go ahead and do something else
>> meanwhile."

(Yuri:) Correct.

(Guido:)> Actually that's not even wrong. When using generators as
coroutines, PEP 342
> style, "yield" means "I am blocked waiting for a result that the I/O
> multiplexer is eventually going to produce".

So does this mean that yield should NOT be used just to yield control
if a task isn't blocked?  (e.g., if its next step is likely to be
long, or low priority.)  Or even that it wouldn't be considered a
co-routine in the python sense?

If this is really just about avoiding busy-wait on network IO, then
coroutine is way too broad a term, and I'm uncomfortable restricting a
new keyword (async or await) to what is essentially a Domain Specific
Language.

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

Reply via email to