Perl or Python?

Christopher Browne cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Jul 2 17:04:09 UTC 2009


On Wed, Jul 1, 2009 at 3:41 PM, Rajinder Yadav<devguy-DaQTI0RpDDMAvxtiuMwx3w at public.gmane.org> wrote:
>
> I am considering investing some time learning a script language to automate stuff etc.
>
> Has anyone here used both/either perl and python?

I would tend to think that Bash is a preferable language for this purpose.

It's not the least bit object oriented, but I don't think that's
notably a downside.

Microsoft was pretty proud when they created Monad/PowerShell, a
"totally object oriented" scripting language with pretty much a
superset of the features of Bash and zsh, where you don't just get
"dumb streams of text," but rather streams of objects.
http://en.wikipedia.org/wiki/Windows_PowerShell

Unfortunately, passing around streams of objects has some really
significant downsides:

1.  Wildly more marshalling of data
2.  Wildly more object declarations

You have to redesign all of your tools that generate output to add in
object declarations to turn them into objects.

And you need to declare the inputs similarly whenever writing a
program accepting input.  A fair bit of that *might* be able to be
handled implicitly (ala the ML thing of polymorphic arguments),
*maybe*.

If you are filtering, then you need to be pretty explicit so that the
objects remain objects as streamed around.

I find I almost always find the "lowest common denominator of plain
text" a fine thing about shell scripting.

I used to write a fair bit of Perl; the last couple of years, I have
been mostly using Bash instead, and finding that preferable.  When
scripting, I usually don't want objects (e.g. - the "Monad mess").
-- 
http://linuxfinances.info/info/linuxdistributions.html
Princess Margaret  - "I have as much privacy as a goldfish in a bowl."
- http://www.brainyquote.com/quotes/authors/p/princess_margaret.html
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list