[Python-Dev] PEP 492: What is the real goal?

Guido van Rossum guido at python.org
Fri May 1 22:32:39 CEST 2015


On Fri, May 1, 2015 at 1:22 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Fri, 1 May 2015 13:10:01 -0700
> Guido van Rossum <guido at python.org> wrote:
> > On Fri, May 1, 2015 at 12:48 PM, Jim J. Jewett <jimjjewett at gmail.com>
> wrote:
> >
> > > 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.
> > >
> >
> > Could you dig up the actual references? It seems rather odd to me to mix
> > coroutines and threads this way.
>
> I think Jim is saying that when you have a non-trivial task running
> in the event loop, you can "yield" from time to time to give a chance
> to other events (e.g. network events or timeouts) to be processed
> timely.
>
> Of course, that assumes the event loop will somehow priorize them over
> the just yielded task.
>

Yeah, but (unlike some frameworks) when using asyncio you can't just put a
plain "yield" statement in your code. You'd have to do something like
`yield from asyncio.sleep(0)`.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150501/11792d2e/attachment-0001.html>


More information about the Python-Dev mailing list