[Python] Where is Python's coroutine type defined?

Discussão em 'Python' iniciado por Stack, Julho 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working on Python 3.5.1 and I want to be able to tell if a function has returned as coroutine object but I cannot find where the coroutine type is defined, instead as of late I've been using the below snippet to get the type through instantiating a coroutine with a function.

    async def _f():
    pass
    COROUTINE_TYPE = type(_f())


    There's got to be a better way to do this, my question is where is this type defined so I can use it directly?

    Continue reading...

Compartilhe esta Página