On 2016-11-08 12:47 AM, Justin Mayfield wrote:
That's quite surprising to me too, BTW. I was focused on generator vs
`async def ...` coros and hadn't even tried the legacy decorator.
Would it be possible for asyncio code to be altered in a way that produces
awaitables which conform with inspect's protocol? Ie. through code flags
or some other flag that inspect looks for? I assume a similar stance could
then be taken by other async libraries.
There is no protocol here. The inspect module is simply tailored for
introspection of builtin types. If something mimics a builtin type (a
coroutine, a generator, or a simple function) inspect utils won't
recognize it.
If it's just not in the cards may I humbly suggest the docs for the inspect
module include some language to help users avoid some of these
idiosyncrasies?
Yes, I think we can improve docs: better clarify what is a
coroutine/coroutine function, reference asyncio functions, add an
example. Feel free to submit a patch!
Yury