[Python-Dev] async/await in Python; v2

Victor Stinner victor.stinner at gmail.com
Sun Apr 26 11:43:03 CEST 2015


Le 25 avr. 2015 23:02, "Yury Selivanov" <yselivanov.ml at gmail.com> a écrit :
> I agree. I plan to update the PEP with some new
> semantics (prohibit passing coroutine-objects to iter(),
> tuple() and other builtins, as well as using them in
> 'for .. in coro()' loops).  I'll add a section with
> a more detailed explanation of coroutine-objects.

Guido rejected the PEP 3152 because it disallow some use cases (create a
coroutine and then wait for it). But careful of not introducing similar
limitation in the PEP 492. There is an open issue to change how to check if
an object is a coroutine: see issues 24004 and 24018.

Well, the issue doesn't propose to remove checks (they are useful to detect
common bugs), but to accept generators implemented in other types for
Cython.

I spend some time in asyncio to valdiate input type because it was to easy
to misuse the API. Example:

.call_soon(coro_func) was allowed whereas it's an obvious bug

See asyncio tests and type checks for more cases.

Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150426/731a819e/attachment.html>


More information about the Python-Dev mailing list