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 asvetlov, dhiltonp, scoder, yselivanov
Date 2019-09-20.04:23:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568953383.72.0.852741844962.issue38225@roundup.psfhosted.org>
In-reply-to
Content
My usual first reaction is: "if you need to find out whether the return value of a callable will be an Awaitable or not, without calling it, then you're probably doing something wrong in your design".

However,
a) there is code that tries this already (and it falls short in various ways while trying)
b) asyncio has a function `iscoroutinefunction` which *seems* to fulfil this need but does not achieve it (because not everything that returns an Awaitable is a "coroutine function")
c) asyncio has an internal protocol for marking things as "is a coroutine", which comes close to but isn't "returns an Awaitable when called"

So – should there be an official protocol for marking callables as returning an Awaitable? Should we look at annotations for that? Anything else? Or do we consider this intention inherently flawed?
History
Date User Action Args
2019-09-20 04:23:03scodersetrecipients: + scoder, asvetlov, yselivanov, dhiltonp
2019-09-20 04:23:03scodersetmessageid: <1568953383.72.0.852741844962.issue38225@roundup.psfhosted.org>
2019-09-20 04:23:03scoderlinkissue38225 messages
2019-09-20 04:23:03scodercreate