469,289 Members | 2,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

Python vs Unix shells

This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=896...312a/0312a.htm
by Cameron Laird.

Reading the article, although I am a fan of Python, I kinda take issue
with the example given. It doesn't seem to fit with the concept of
'many smaller utilities doing one thing well, connected via pipes'

If I had the task of writing a Unix utility to match the GUI Python
example I would prefer to either:
1) save a sorted file listing to a temporary file then use either
$EDITOR or vi to edit the temporary file, and on completion extract
those files mentioned in the temporary file. OR
2) Write a general argument selector in Python that could be imported
in a larger Python prog as a module where its function would be to
display a python list of strings in a GUI and return those selected,
OR when executed as a command, it would display all its arguments in
the order given, and return those selected. The command line versions
could have options to sort the input and to either return space
separated or newline separated versions of its output (and maybe CSV
too).

The advantages of the first is that you would use the users $EDITOR.
The user will be on familiar territory, and not much extra programming
is needed.

The advantages of 2 are that you end up with a python module/script
that is *re-usable* both in a Python program and as a command line
script in the tradition of Unix utilities.
Such Python module/scripts if collected on a central web site could
form a useful resource for System Administrators.

Whoops, I almost forgot, The third way might be to look up utilities
for adding GUIs to command line utilities and using those. (e.g.
kaptain at http://kaptain.sourceforge.net )

To summarize then, using similar reasons for writing a script for the
simple tar extraction; when you write your Python version you might
want to modularize reusable components but also make that Python
module a command line utility itself.

Cheers, Pad.
Jul 18 '05 #1
4 1515
In <comp.lang.python> Paddy McCarthy <pa*******@netscape.net> wrote:
This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=896...312a/0312a.htm
by Cameron Laird.

Reading the article, although I am a fan of Python, I kinda take issue
with the example given. It doesn't seem to fit with the concept of
'many smaller utilities doing one thing well, connected via pipes'


What did you expect from a Python consultant? He has the right to make
a living and advertise his expertise.

--
William Park, Open Geometry Consulting, <op**********@yahoo.ca>
Linux solution for data management and processing.
Jul 18 '05 #2
William Park <op**********@yahoo.ca> wrote in message news:<br************@ID-99293.news.uni-berlin.de>...
In <comp.lang.python> Paddy McCarthy <pa*******@netscape.net> wrote:
This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=896...312a/0312a.htm
by Cameron Laird.

Reading the article, although I am a fan of Python, I kinda take issue
with the example given. It doesn't seem to fit with the concept of
'many smaller utilities doing one thing well, connected via pipes'


What did you expect from a Python consultant? He has the right to make
a living and advertise his expertise.


Hi William,
I don't understand why you made your comment?
I was expecting replies of maybe "the pressures of getting an example
to fit the article made his example maybe a little artificial" (but
still useful). or people agreeing or disagreeing with the idea of
modules that are also Unix scripts.
I can't see how Cameron being a consultant has anything to do with it.

Cheers, Paddy.
Jul 18 '05 #3
In article <2a**************************@posting.google.com >,
Paddy McCarthy <pa*******@netscape.net> wrote:
Jul 18 '05 #4
In article <vt************@corp.supernews.com>,
cl****@lairds.com (Cameron Laird) wrote:
... In other articles, I've said a few
words about the difficulty of writing good examples for an
audience of systems administrators; I do find it hard not
being "maybe a little artificial" (I appreciate your gentle
touch), without complexification that loses the reader.


Maybe the category is a little artificial, in that system
administration isn't really a computer programming domain
like numeric, hardware control, rendering, web publishing.

I suppose that's part of your point, when you talk about
writing your own tools rather than buying packaged solutions.
Not many good packaged solutions for Miscellaneous Little Tasks.

Donn Cave, do**@u.washington.edu
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Eric Pederson | last post: by
2 posts views Thread by Xah Lee | last post: by
reply views Thread by Xah Lee | last post: by
22 posts views Thread by Ryan M | last post: by
9 posts views Thread by Adriano Ferreira | last post: by
14 posts views Thread by Kenneth McDonald | last post: by
30 posts views Thread by bblais | last post: by
reply views Thread by Cameron Simpson | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.