scripting languages

Michael Torrie torriem at gmail.com
Mon Nov 8 12:19:15 MST 2010


On 11/08/2010 10:21 AM, Kenneth Burgener wrote:
> stringing several external commands is more 
> complicated (very simple in bash an Perl), but Python does have good 
> readability and vast libraries, and is becoming the popular choice.

I used to think this as well.  Then I realized I was using Python wrong.
 The only reason you string things together in Bash is usually because
Bash really doesn't do much on its own.  So you'd do something like:

ps ax | grep blah | grep -v grep | awk ' { print $1; }'

Whereas in Python  you could simply execute the ps ax command and then
process the output through generators as I describe in the like in my
previous post.

With the expressive power of generators, it makes up quite nicely for
the lack of easy subprocess piping.


More information about the PLUG mailing list