[BangPypers] Command line goodies

Noufal Ibrahim noufal at gmail.com
Wed Mar 25 18:41:26 CET 2009


> I don't agree. It is painful to write command liners with python.

My thoughts exactly. Although I like the examples the other Anand gave. :)

As for code one-liners, the indentation rules do contain some
obfuscation. The language culture that emphasises readability over
tricks is also a nail in the coffin for one liners.


On 3/25/09, Anand Chitipothu <anandology at gmail.com> wrote:
>> Really ? FYI, Python is full of one-liners both of the command-line
>> variety and the code variety.
>
> I don't agree. It is painful to write command liners with python.
>
> Look at this perl one liner that replaces .py with .txt.
>
> ls *.py | perl -ne 's/.py$/.txt/; print $_;'
>
> Try writing it in Python and you will know how painful it is.
>
> Also Python doesn't go well with pipes. For example, the following
> code produces an error.
>
> python -c 'while True: print "hello"' | head -1
>
> But its perl equivalent doesn't.
>
> perl -e 'while(1) { print "hello\n"; }' | head -1
>
> -Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


-- 
~noufal


More information about the BangPypers mailing list