Dumb Question? Type for Coroutine Function?
I see a type for a coroutine (collections.abc.Coroutine), but I'm looking for a type to represent a coroutine function, i.e. asyncio.iscoroutinefunction(val) == True. If course, I can use (am currently using) collections.abc.Callable, but am hoping for something more explicit. Wondering why I'm not finding it. What am I missing?
I think it's any Callable whose return type is Coroutine. A shared base type for all those would be ``` Callable[..., Coroutine[Any, Any, Any]] ``` On Thu, Feb 18, 2021 at 1:34 PM Paul Bryan <pbryan@anode.ca> wrote:
I see a type for a coroutine (collections.abc.Coroutine), but I'm looking for a type to represent a coroutine *function*, i.e. asyncio.iscoroutinefunction(val) == True. If course, I can use (am currently using) collections.abc.Callable, but am hoping for something more explicit. Wondering why I'm not finding it. What am I missing? _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: guido@python.org
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
Aha, of course. Thanks. On Thu, 2021-02-18 at 19:18 -0800, Guido van Rossum wrote:
I think it's any Callable whose return type is Coroutine. A shared base type for all those would be ``` Callable[..., Coroutine[Any, Any, Any]] ```
On Thu, Feb 18, 2021 at 1:34 PM Paul Bryan <pbryan@anode.ca> wrote:
I see a type for a coroutine (collections.abc.Coroutine), but I'm looking for a type to represent a coroutine function, i.e. asyncio.iscoroutinefunction(val) == True. If course, I can use (am currently using) collections.abc.Callable, but am hoping for something more explicit. Wondering why I'm not finding it. What am I missing? _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: guido@python.org
participants (2)
-
Guido van Rossum
-
Paul Bryan