Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm in a similar boat. I've largely switched to Python as my scripting language (except for one-liners), but I'll still defend Perl against those who dismiss it out of hand. After using it an Amazon, I've seen firsthand how productive one can be with the language; and, if you're careful (following, e.g., the guidelines in "Perl Best Practices" by Conway) it's very possible to write maintainable code as well.


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


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?


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/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: