time.sleep(0) is used for a thread context switch, it is very well
known feature.
await asyncio.sleep(0) does the same for async tasks.
Why do we need another API?

On Fri, Jun 14, 2019 at 4:43 PM Joao S. O. Bueno <jsbu...@python.org.br> wrote:
>
> Regardless of a mechanism to counting time, and etc...
>
> Maybe a plain and simple adition to asincio would be a
> context-switching call that does what `asyncio.sleep(0)` does today?
>
> It would  feel better to write something like
> `await asyncio.switch()`  than an arbitrary `sleep`.
>
> On Fri, 14 Jun 2019 at 10:27, Nikita Melentev <multisosnoo...@gmail.com> 
> wrote:
>>
>> Fortunately, asyncio provide this good universal default: 100ms, when WARING 
>> appears. Nested loops can be solved with context manager, which will share 
>> `last_context_switch_time` between loops. But main thing here is that this 
>> is strictly optional, and when someone will use this thing he will know what 
>> it is and why he need this.
>> _______________________________________________
>> Python-ideas mailing list -- python-ideas@python.org
>> To unsubscribe send an email to python-ideas-le...@python.org
>> https://mail.python.org/mailman3/lists/python-ideas.python.org/
>> Message archived at 
>> https://mail.python.org/archives/list/python-ideas@python.org/message/UT5LEWS4XX5IJ64AMMYKJVG2BNYZXYQY/
>> Code of Conduct: http://python.org/psf/codeofconduct/
>
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/4ZTLXBAQPFYQNITNB3RLRCW5D2QXKGBI/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Thanks,
Andrew Svetlov
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DKMOQYF447QBM2IZNZOJIAUPVE4MRYNU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to