I want to queue
lambda : Popen(.....)
To call/wait at a later time. Then add some more to paused Popens to the queue, then consume them again and so on.
The main Queue module cares a lot about synchronization and this makes the api feel a bit weird in places. I don't care about syncing(single threaded program, Popen just do their job and throw exception on error and they don't affect the environment in any important ways(they generate files)
Should I just use a generator that I add to it at a later time. If so whats a good way to add items to generators, calling
gena = itertools.chain(gena,[item))
each time seems wastefull.
Yes, you can use a deque (collections.deque), which is a list that you can efficiently push and pop on either end. You could also use a list and not worry about the inefficiency since it probably doesn't matter.