Opinion on best practice...

Nobody nobody at nowhere.com
Wed Feb 6 04:32:50 CET 2013

On Tue, 05 Feb 2013 21:01:56 +0000, Walter Hurry wrote:

> Hooray for common sense! Python is great, but it's silly to use Python 
> (unless there is good reason) when a simple shell script will do the job.

A shell script is only the better option if (almost) the *only* thing the
script needs to do is to execute commands.

The moment you start trying to "process" data, it's time to put up with
the verbosity of subprocess.Popen() so that you can use a well-designed
language for the rest of it.

Shells are designed first and foremost for interactive use, and everything
else is compromised by that fact.

Minimising the number of keystrokes is a great idea for something which
will be typed, executed and forgotten. It's an awful idea if you're going
to modify the script in six months' time.

Making the execution of commands a fundamental language feature is a great
idea if that's most of what you do, but not such a great idea if you'll be
doing a lot else besides (because most of the available syntax has been
"consumed" by command execution).

More information about the Python-list mailing list