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

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



On 2007-08-18 22:33:57 -0400, Douglas A. Tutty wrote:
> I guess a problem is the lack of definition of 'clean coding'.  I don't
> consider one-liners as clean code.

One-liners *can* be clean code. I have lots of very clean and readable
one-liners in my Makefiles.

Also, I like the following one (very useful):

diff "$@[1,-4]" <($@[-3] "$@[-2]") <($@[-3] "$@[-1]")

It may seem obfuscated, but it's quite clear once one knows the language.
Probably more than if you wrote it in Python.

> 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.

Yes, try including Python in Makefiles. :)

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Reply to: