Can you try this?

async def __sleep(self):
    await None

On Thu, Feb 18, 2021 at 22:31 Luciano Ramalho <luci...@ramalho.org> wrote:

> Follow up question: what's the plan to replace this use of
> `@types.coroutine` in `asyncio/tasks.py`? [1]
>
> @types.coroutine
> def __sleep0():
>      """<docstring omitted>"""
>      yield
>
> [1]
> https://github.com/python/cpython/blob/master/Lib/asyncio/tasks.py#L585
>
> Best,
>
> Luciano
>
> On Fri, Feb 19, 2021 at 2:31 AM Luciano Ramalho <luci...@ramalho.org>
> wrote:
> >
> > On Fri, Feb 19, 2021 at 1:59 AM Guido van Rossum <gu...@python.org>
> wrote:
> > >> 1) What Python construct is to be used at the end of a chain of await
> > >> calls, if not of a generator-based coroutine decorated with
> > >> `@types.coroutine` and using a `yield` expression in its body?
> >
> > > At the end of the chain you can call the __await__() method which
> gives an iterator, and then you call next() or send() on that iterator.
> Each next()/send() call then represents an await step, and send() in
> general is used to provide an awaited result. Eventually this will raise
> StopIteration with a value indicating the ultimate result (the return value
> of the top-level async def).
> >
> > All right, that made sense to me. Thank you so much, Guido.
> >
> > Thanks for the clarification about `@types.coroutine` as well.
> >
> > Take care,
> >
> > Luciano
> >
> >
> > --
> > Luciano Ramalho
> > |  Author of Fluent Python (O'Reilly, 2015)
> > |     http://shop.oreilly.com/product/0636920032519.do
> > |  Technical Principal at ThoughtWorks
> > |  Twitter: @ramalhoorg
>
>
>
> --
> Luciano Ramalho
> |  Author of Fluent Python (O'Reilly, 2015)
> |     http://shop.oreilly.com/product/0636920032519.do
> |  Technical Principal at ThoughtWorks
> |  Twitter: @ramalhoorg
>
-- 
--Guido (mobile)
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/UAG36OWYCNOYSXQXRBIWML7IHR4IKEAO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to