The example from the code is:
p1 = Popen(["dmesg"], stdout=PIPE) p2 = Popen(["grep", "hda"], stdin=p1.fromchild) result = p2.communicate()
Some things immediately spring from this:
- stdout=PIPE doesn't feel like it adds anything. It's "obvious" that I want a pipe. But of course there's no way the code realises that unless I say so.
- fromchild doesn't look too nice. I'd prefer to use "stdin=p1.stdout".
You too? :-) I'm almost convinced now that we should really drop this popen2 syntax...
- communicate() doesn't really describe what it does very well.
Give me some other alternatives...
Maybe inverting the sense of the argument, and saying pipe=STDOUT, or in the case of multiple pipes, pipe=(STDIN, STDOUT), is better. What do people think?
I think this is worse than the current syntax.
PS If this becomes a design discussion, is python-dev (or even python-list) appropriate? Would it be better to set up a SIG for this, much like optparse had the getopt-sig for a while?
If there's interest, I can arrange a mailing list in matter of minutes.