On 06/05/2016 10:01 PM, Michael Torrie wrote: > I've thought about this before and even tried my hand at creating a nice > library for doing this sort of thing with Python. Generators seem like > a natural analog for the shell pipes. However there is one big problem > with them and that is they can only deal with one stream at a time. > Whereas in shell programming there are 2 streams that you can use and > connect simultaneously. For example I can simultaneously pipe standard > out from a program to another command whilst piping standard error to > another. I never figured out a way to emulate this idea of piping > multiple streams.
When I say that Python generators can only deal with one stream at a time I mean within the context of generator syntax: for x in gen(gen(gen(...))) Obviously I could write a function that returns two generators. It's just that you can't nest them cleanly. Not that bash's syntax is particularly clean when you are messing with standard error as well as standard out. -- https://mail.python.org/mailman/listinfo/python-list