Python vs Unix shells

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paddy McCarthy

    Python vs Unix shells

    This is really a comment on "Python in Systems Administration: Part I
    -- Better Scripting"

    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.
  • William Park

    #2
    Re: Python vs Unix shells

    In <comp.lang.pyth on> Paddy McCarthy <paddy3118@nets cape.net> wrote:[color=blue]
    > 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'[/color]

    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, <opengeometry@y ahoo.ca>
    Linux solution for data management and processing.

    Comment

    • Paddy McCarthy

      #3
      Re: Python vs Unix shells

      William Park <opengeometry@y ahoo.ca> wrote in message news:<brg1jf$2v 6cj$1@ID-99293.news.uni-berlin.de>...[color=blue]
      > In <comp.lang.pyth on> Paddy McCarthy <paddy3118@nets cape.net> wrote:[color=green]
      > > 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'[/color]
      >
      > What did you expect from a Python consultant? He has the right to make
      > a living and advertise his expertise.[/color]

      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.

      Comment

      • Cameron Laird

        #4
        Re: Python vs Unix shells

        In article <2ae25c6b.03121 40316.77f7059f@ posting.google. com>,
        Paddy McCarthy <paddy3118@nets cape.net> wrote:

        Comment

        • Donn Cave

          #5
          Re: Python vs Unix shells

          In article <vtrhpu26nohvae @corp.supernews .com>,
          claird@lairds.c om (Cameron Laird) wrote:[color=blue]
          > ... 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 complexificatio n that loses the reader.[/color]

          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, donn@u.washingt on.edu

          Comment

          Working...