[Python-Dev] PEP 492: Please mention the Event Loop
Jim J. Jewett
jimjjewett at gmail.com
Tue May 5 23:09:54 CEST 2015
On Tue May 5 21:44:26 CEST 2015,Brett Cannon wrote:
> It's not as
> complicated as it seems when you realize there is an event loop driving
> everything (which people have been leaving out of the conversation since it
> doesn't tie into the syntax directly).
Another reason people don't realize it is that the PEP goes out
of its way to avoid saying so.
I understand that you (and Yuri) don't want to tie the PEP too
tightly to the specific event loop implementation in
asyncio.events.AbstractEventLoop, but ... that particular
conflation isn't really what people are confused about.
"coroutines" often brings up thoughts of independent tasks. Yuri may
well know that "(Python has asymmetric coroutines, that's it)", but
others have posted that this was a surprise -- and the people posting
here have far more python experience than most readers will.
Anyone deeply involved enough to recognize that this PEP is only about
(1) a particular type of co-routine -- a subset even of prior python usage
(2) used for a particular purpose
(3) coordinated via an external scheduler
will already know that they can substitute other event loops.
Proposed second paragraph of the abstract:
This PEP assumes that the asynchronous tasks are scheduled and
coordinated by an Event Loop similar to that of stdlib module
asyncio.events.AbstractEventLoop. While the PEP is not tied to
any specific Event Loop implementation, it is relevant only to
the kind of coroutine that uses "yield" as a signal to the scheduler,
indicating that the coroutine will be waiting until an event (such
as IO) is completed.
If there are still threading problems with my replies, please
email me with details, so that I can try to resolve them. -jJ
More information about the Python-Dev