On Sat, Jun 13, 2020 at 02:09:53PM +1200, Greg Ewing 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.
Ignorant question here... isn't that at least in part *because* they are designed to be concurrent not parallel? Coroutines are lighter weight than threads because they don't need all the machinary to pre-emptively run threads in parallel; threads are lighter weight than processes because they don't need to be in separate memory spaces enforced by the OS. So if you give up the manual concurrency of coroutines and use them as if they were threads, doesn't that just make them like threads, including roughly the same overhead thereof? -- Steven _______________________________________________ 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/3DXW32FDIQOTSHCAHSSELVRKLPM6JHJA/ Code of Conduct: http://python.org/psf/codeofconduct/