News for hackers. Stuff that matters.
Re:Perl is 25 years old today by gvalkov on Tuesday December 18, 2012 @08:40AM (#4937409)
I hear you on the one-liners issue. Python is unhelpful when it gets to that - there are no -n, -p, -l switches or special variables like there are in Perl and Ruby.

It's a shame really, since all the building blocks needed to implement a useful mode for writing one-liners are there. In fact, I have a work in progress module that tries to address this issue: https://github.com/gvalkov/python-oneliner

Re:Perl is 25 years old today by slurgfest on Tuesday December 18, 2012 @10:38AM (#4937931)
This is an interesting idea, but if you need an extremely terse DSL which doesn't look anything like Python and has to be learned anew, why not just use Perl directly? Maybe for environments where you can't install Perl?
Re:Perl is 25 years old today by gvalkov on Tuesday December 18, 2012 @12:39PM (#4938541)
Thanks. My approach is actually pretty minimal. Just a read-print-loop (-n, -p), a few local variables (equivalents of $_, $~, $. etc) and a shorthand import syntax to take away some of the verbosity. There are other projects, such as pyp[1], that are more ambitious, but put you through a learning process.

By all means, everybody should use what they are comfortable with. Ruby and Perl allow you to write extremely terse and awesome one-liners, the likes of which will never be possible in Python. But if the first solution that pops into your head is a Python one, why not use that?

[1] http://code.google.com/p/pyp/