
On 2019-12-11 22:45, Antoine Pitrou wrote:
On Mon, 9 Dec 2019 21:42:36 -0500 Kyle Stanley <aeros167@gmail.com> wrote:
(b) Why limit coroutines? It's just another Python object and has no operating resources associated with it. Perhaps your definition of coroutine is different, and you are thinking of OS threads?
This was my primary concern with the proposed PEP. At the moment, it's rather trivial to create one million coroutines, and the total memory taken up by each individual coroutine object is very minimal compared to each OS thread.
There's also a practical use case for having a large number of coroutine objects, such as for asynchronously: [...] 2) Sending a large number of concurrent database transactions to run on a cluster of database servers.
1M concurrent database transactions? Does that sound reasonable at all? Your database administrator probably won't like you.
Right. Instead, you use a pool of DB connections, making each coroutine await its turn to talk to the DB. You can still have a million coroutines waiting. (Or as Guido put it, a coroutine "just another Python object and has no operating resources associated with it". I still sense some confusion around what was meant there.)