3 ms·
In my personal experience almost every large Python program is a little multithreaded. For example, if you need to handle the external programs input, stdout a
by CJefferson 3y ago
In my personal experience almost every large Python program is a little multithreaded.
For example, if you need to handle the external programs input, stdout and errout, most of the examples you find by googling use threads for this.
- norir 3y agoI'm sure you know this, but as a general psa: threads are the lowest common denominator way of doing this kind of thing. Where possible, it is nicer to use epoll/kqueue/whatever the windows equivalent is. For a library though I totally get how annoying it would be to interface with the platform event system on each os. Indeed, if there isn't already a python library that can handle subprocesses for you on a single thread then it might be something worth building (I don't use python personally so I don't know the ecosystem).