[Python-bugs-list] popen2.popen3 and win32pipe.popen3 has unconsistancy interface. (PR#386)

Guido van Rossum guido@beopen.com
Thu, 06 Jul 2000 10:44:27 -0500


> posix     : popen2.popen3(output, input, error)
> win32pipe : win32pipe.popen3(input, output, error)

[He's referring to the order of the output variables]

> Need an ntpopen.py module as ntpath.py do ? oh cool idea for the dude who does
> it.
> I used next code to continue using popen3 in that situation but what a shame to
> do so.
> 
> [...]
> def CC_popen3(commande, mode):
>   global nb                                   # forget this .. this is just to
>   if V: print __module__+": IN CC_popen3",nb  # capture number of open pipe 
>   nb = nb + 1                                 # seem to hang popen2.popen3
> after
>                                               # about 170 calls.
>                                               # (no further expert so forget)
>   if sys.platform == "win32":
>     from win32pipe import popen3
>     (i,o,e) = popen3(commande, mode)
>     return (i,o,e)
>   elif os.name == "posix":
>     from popen2 import popen3
>     (o,i,e) = popen3(commande, mode)
>     return (i,o,e)
>   else:
>     raise CC_env_error, "env: CC_popen3 : ERROR : Unsupported Operating System"
> [...]
> 
> QUESTION / DISCUSSION:
>  what is the best way ? (i,o,e) or (o,i,e) ? i choose (i,o,e) cause this is a
> reading behaviour and is more comprehensive. I know that choose is subjective.
>  So what need the futur to be ?
>  Tel me that convergence is THE way. never mind about the order ;-)

It's hard to fix either win32pipe or popen2, but it seems that (i,o,e)
is the proper order.  popen2 did it the other way historically,
probably because o was more important -- but that was a bad mistake
that we'll have to live with.

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)