[Python-ideas] The async API of the future: yield-from

Matt Joiner anacrolix at gmail.com
Tue Oct 16 01:37:58 CEST 2012


I gave something like this a go a while ago:
https://bitbucket.org/anacrolix/green380

"Coroutines" yield events or futures as Nick put them from the top, and the
scheduler at the bottom manages events and scheduling.

There are a few things I took away from this attempt:

1) Explicit yield a la PEP380 requires syntactical changes *everywhere*.

2) Python's dynamic typing means that neglecting to "yield from" gives you
broken code, and Python won't help you here. Add to this that you now have
a 380, and "normal synchronous" form of most interfaces and the caller must
know what kind is used at all times.

3) Concurrency is nice, but it requires language-level support, and proper
parallelism to really shine. The "C way" of doing things is already so
heavily ingrained in Python, an entirely new standard library and
interpreter that breaks C compatibility is really the only way to proceed,
and this certainly isn't worth it just to write code with "yield from"
littered on every line.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121016/3786b867/attachment.html>


More information about the Python-ideas mailing list