On Sat, Jun 13, 2020 at 12:11 PM Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
>
> On 13/06/20 9:37 am, Chris Angelico wrote:
> > If you don't care where the context
> > switches happen and just want everything to behave sanely by default,
> > use threads, not coroutines.
>
> There are other reasons for using coroutines, such as the fact that
> they're very lightweight compared to threads. Telling people to
> "just use threads" without knowing more about their use case is
> not helpful.
>

Perhaps, but the fact is that the described use-case is VERY closely
aligned with threads. They behave exactly as the OP is hoping for. So
it's up to the OP to explain why threads *wouldn't* be appropriate,
which could be something like "ahh but I need 2000 of these at once, I
tried it with threads and it cost too much RAM". But without a
justification of the inappropriateness of threads, I stand by the
recommendation.

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

Reply via email to