On Mon, Nov 27, 2017 at 1:58 PM, Greg Ewing <[email protected]>
wrote:
> Guido van Rossum wrote:
>
>> The source for sleep() isn't very helpful -- e.g. @coroutine is mostly a
>> backwards compatibility thing.
>>
>
> So how are you supposed to write that *without* using @coroutine?
>
A simplified version using async def/await:
async def sleep(delay):
f = Future()
get_event_loop().call_later(delay, f.set_result)
await f
--
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com