This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients Ben.Darnell, Yury.Selivanov, asvetlov, gvanrossum, martin.panter, ncoghlan, python-dev, r.david.murray, scoder, vstinner, yselivanov
Date 2015-07-03.06:41:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <55962EAF.9050506@behnel.de>
In-reply-to <1435901285.73.0.645336828546.issue24400@psf.upfronthosting.co.za>
Content
> 1. abc.Coroutine and abc.Awaitable will guarantee that objects that implement them have '__await__' and it's safe to access it (that means that they will fail for generator-based coroutines).

Absolutely. That was the main theme behind the whole type split.

> 2. inspect.isgenerator() can be used along with inspect.isawaitable() to detect generator-based coroutines (generators with CO_ITERABLE_COROUTINE flag).

I still don't like the idea of having an inspect.isawaitable() that only
checks for an ABC. If you want an ABC test, say it in your code. If you
want to test for an "__await__" attribute, say it. A helper function
inspect.isawaitable() suggests that there is some (builtin) type to inspect
here, not a protocol. ABCs are about abstract protocols, inspect is about
concrete types.

If you want to cover the "iterable coroutine" case, why not add an inspect
helper function for that? That's clearly a concrete type (even more
concrete than a concrete type) that can be inspected.
History
Date User Action Args
2015-07-03 06:41:54scodersetrecipients: + scoder, gvanrossum, ncoghlan, vstinner, r.david.murray, asvetlov, Yury.Selivanov, python-dev, Ben.Darnell, martin.panter, yselivanov
2015-07-03 06:41:54scoderlinkissue24400 messages
2015-07-03 06:41:54scodercreate