[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash vs. python scripts - which one is better?



On Sat, Aug 18, 2007 at 08:30:04PM -0500, Ron Johnson wrote:
> On 08/18/07 18:28, Steve Lamb wrote:
> > Ron Johnson wrote:
> >> I've written enough cryptic Python and lucid C & bash to know that
> >> Python does *not* enforce clean coding.
> > 
> >     I don't think anyone has ever claimed that.
> 
> Doug Tutty did this afternoon.  (You conveniently snipped that part
> out of your reply.)
> 
> http://lists.debian.org/debian-user/2007/08/msg01743.html
> 
>     whereas python enforces clean coding.
> 
> >> What a waste.  bash is *great* for looping thru lists.  (Perfect?
> >> No.  But still great.)
> > 
> >     So is Python with the added benefit of not having to defeat globbing
> > at every step of the way.
> 
> Sure, not having to worry about globbing rules can be handy.  But
> there's still a large set of problems that can quickly be solved by
> a one-line bash for/done loop.

I guess a problem is the lack of definition of 'clean coding'.  I don't
consider one-liners as clean code.  Terse yes but they lack the visual
flow that I need when I need to revamp code a year later.  One-liners
are more of a challenge to do in python since indentation has an impact
on syntax.

As for which language is best, the answer is none.  Any language can
probably do anything, but for any problem one may be easier than
another.  It will likely be the one you are more generally good at.  I
find sh to be more cryptic than python so I turn to it sooner, which
leads over time to me becoming more and more comfortable with python.
So for problems that are best solved with some disposable code, it comes
down to in which language in which you produce functional code the fastest
and easiest.

Perhaps the OP can restate his needs and we can help him make a reasoned
choice without it becoming a religious issue.

Doug.



Reply to: