[Python-Dev] PEP 324: popen5 - New POSIX process module (original) (raw)
Peter Astrand astrand at lysator.liu.se
Tue Jan 6 16:25:51 EST 2004
- Previous message: [Python-Dev] PEP 324: popen5 - New POSIX process module
- Next message: [Python-Dev] Re: [Python-checkins] python/nondist/sandbox/msi msilib.py, 1.2, 1.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The example from the code is:
p1 = Popen(["dmesg"], stdout=PIPE) p2 = Popen(["grep", "hda"], stdin=p1.fromchild) result = p2.communicate()[0] Some things immediately spring from this: 1. 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. 2. 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...
3. 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.
-- /Peter Åstrand <astrand at lysator.liu.se>
- Previous message: [Python-Dev] PEP 324: popen5 - New POSIX process module
- Next message: [Python-Dev] Re: [Python-checkins] python/nondist/sandbox/msi msilib.py, 1.2, 1.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]