Earlier quoted context omitted.
Anything that encourages a from ... import * usage is evil irrespective of its implementation.
Why?
Fixing the Python subprocess interface
11–20 of 65 posts
Re: Fixing the Python subprocess interface
#12Earlier quoted context omitted.
Anything that encourages a from ... import * usage is evil irrespective of its implementation.
Why?
somewhat naive example:
>>> time = 'blah'
>>> time
'blah'
>>> from datetime import *
>>> time
>>>Re: Fixing the Python subprocess interface
#13Earlier quoted context omitted.
Anything that encourages a from ... import * usage is evil irrespective of its implementation.
Why?
It's especially bad in this case where adding an executable in the system can suddenly shadow any built-in name (e.g. imagine someone adds a "print" or "sys" executable).
Re: Fixing the Python subprocess interface
#14Why not use pipes for piping? e.g. print du("*", "-sb") | sort("-rn")
Re: Fixing the Python subprocess interface
#15Earlier quoted context omitted.
Anything that encourages a from ... import * usage is evil irrespective of its implementation.
Why?
let's say you have
from a import foo from b import *
what does 'foo' refer to? 'b' could contain 'foo', which would overwrite your previous reference to 'a.foo'. its hard to figure out what 'foo' now refers to from inspecting the code. its better to be explicit:
from a import foo from b import bar, baz
Re: Fixing the Python subprocess interface
#16Re: Fixing the Python subprocess interface
#17All that said, this is horribly un-Pythonic. A much better route to so is something like envoy[1] which simply wraps `subprocess` in a sane API.
Re: Fixing the Python subprocess interface
#18Re: Fixing the Python subprocess interface
#19For a sane alternative I'd recommend Kenneth Reitz' awesome Envoy (https://github.com/kennethreitz/envoy)
Re: Fixing the Python subprocess interface
#20I code in Ruby for a living, and this is even a bit much magic for me. I suppose you can use it in magic-less mode with `from pbs import Command`, and set up your command set manually.