Gustavo Carneiro wrote:
1. If you don't yield in the for loop body, then you are blocking the main loop for 1 second;

2. If you yield in every iteration, you solved the task switch latency problem, but you make the entire program run much slower.

It sounds to me like asyncio is the wrong tool for this job. You
want a background task that can be preempted by a foreground task.
That's what threads are for. Asyncio gives you non-preemptive
task scheduling.

--
Greg
_______________________________________________
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/RLGF5NOLRXYGEOWTLT4N6KYAWRWXHI6J/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to