[Python-ideas] shutil.runret and shutil.runout

anatoly techtonik techtonik at gmail.com
Fri Feb 24 12:12:29 CET 2012


On Fri, Feb 24, 2012 at 1:59 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Feb 24, 2012 at 8:52 PM, anatoly techtonik <techtonik at gmail.com> wrote:
>> Hello,
>>
>> subprocess is low level, cryptic, does too much, with poor usability,
>> i.e. "don't make me think" is not about it. I don't know about you,
>> but I can hardly write any subprocess call without spending at least
>> 5-10 meditating over the documentation.
>
> I believe you'll find the simple convenience methods you are
> requesting already exist, in the form of subprocess.call(),
> subprocess.check_call() and subprocess.check_output(). The
> documentation has also been updated to emphasise these convenience
> functions over the Popen swiss army knife.

I don't find the names of these functions more intuitive than Popen().
I also think they far from being simple, because (in the order of appearance):

1. they require try/catch
2. docs still refer Popen, which IS complicated
3. contain shell FUD
4. completely confuse users with stdout=PIPE or stderr=PIPE stuff

http://docs.python.org/library/subprocess.html#subprocess.check_call

My verdict - these fail to be simple, and require the same low-level
system knowledge as Popen() for confident use.

> If you do "pip install shell-command" you can also access the
> shell_call(), shell_check_call() and shell_output() functions I
> currently plan to include in subprocess for 3.3. (I'm not sure which
> versions of Python that module currently supports though - 2.7 and
> 3.2, IIRC).

Don't you find strange that shell utils module don't have any
functions for the main shell function - command execution?
In game development current state of subprocess bloat is called
"featurecrepping" and the "scope definition" is a method to cope with
this disease.
--
anatoly t.



More information about the Python-ideas mailing list