[Python-Dev] PEP 492: What is the real goal?
Jim J. Jewett
jimjjewett at gmail.com
Fri May 1 21:48:51 CEST 2015
On Fri, May 1, 2015 at 2:59 PM, Guido van Rossum <guido at python.org> wrote:
> On Fri, May 1, 2015 at 11:26 AM, Jim J. Jewett <jimjjewett at gmail.com> wrote:
>>
>> On Thu, Apr 30, 2015 at 3:32 PM, Guido van Rossum <guido at python.org>
>> wrote:
>>
>> (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?
> I'm not sure what you're talking about. Does "next step" refer to something
> in the current stack frame or something that you're calling?
The next piece of your algorithm.
> None of the
> current uses of "yield" (the keyword) in Python are good for lowering
> priority of something.
If there are more tasks than executors, yield is a way to release your
current executor and go to the back of the line. I'm pretty sure I
saw several examples of that style back when coroutines were first
discussed.
-jJ
More information about the Python-Dev
mailing list