[Python-ideas] Function multiple arguments assignment

Antoine Pitrou solipsis at pitrou.net
Tue Mar 22 16:11:33 CET 2011

On Tue, 22 Mar 2011 20:01:25 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Tue, Mar 22, 2011 at 7:16 PM, Giampaolo Rodolà <g.rodola-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
> > It's likely this has already been proposed in past, I don't know, anyway...
> > This occurred to me while using subprocess module yesterday.
> > I had to do something like this:
> >
> > subprocess.Popen(["exe"], stdin=subprocess.PIPE,
> > stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> >
> > Would it be appropriate to permit something similar to multiple
> > variable assignment such as:
> >
> > subprocess.Popen(["exe"], stdin=stdout=stderr=subprocess.PIPE)
> Hitting a gnat with a hammer.
> Something that may make more sense is a PopenPipe that changes the
> default for stdin/out/err to be distinct pipes rather than inherited
> from the parent (but still able to be set explicitly). It is certainly
> annoying that creating a fully piped subprocess is so verbose.

It's much less verbose if you use "from subprocess import PIPE"
(which is unlikely to conflict with anything else in your module
namespace, I think).



More information about the Python-ideas mailing list