[Tutor] calling other process?

Bernard Rankin berankin99 at yahoo.com
Mon Feb 9 02:06:04 CET 2009





> > Is:
> >
> > from subprocess import Popen
> > output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
> >
> > Really the replacement for:
> >
> > output = `mycmd myarg`
> 
> Yes, because it works more consistently and reliably across
> operating systems for one reason. Its also much more powerful
> and flexible.
> 
[SNIP]
> Remember that in the zen of Python :
> a) There should be one-- and preferably only one --obvious way to do 
> it.
> b) explicit is better than implicit.
> 
> http://www.python.org/dev/peps/pep-0020/
> 


Thanks for clearing that up. 

Not to discount the Python Zen, but me thinks there could be a little more "Make easy things easy, and hard things possible"in this aspect of Python .  :)



      



More information about the Tutor mailing list