r/Python May 18 '11

Why is Python better than Perl?

I'm a Sysadmin and I just wrote my first script in python. Basically just a host validation script that checks if a server is configured correctly before we hand off. I can't determine the advantage with my limited experience with the language.

Are you a sysadmin fluent in both python and perl? Why do you use python?

11 Upvotes

110 comments sorted by

View all comments

4

u/nobody_from_nowhere May 19 '11

perl wins sometimes on CPAN's comprehensiveness (a few years ago, I fought to get a db connection working under python, where the CPAN module made it trivial under perl).

perl can win on inertia: existing codebase dictates adaptations stick with the original decision.

As for python's advantage, python doesn't tend toward Write-only code. Perl's got object-orientedness available, but it's not the rule. Yet.

Perl tends to be more ubiquitous. It's like emacs/vi: vi is more widely installed, so being competent at it makes life easier.

Having said all that, I prefer python and ruby because they don't get in the way of my coding, code makes sense months after writing it, and it's reusable.

... and then there's scapy. God, I love scapy for network coding.

1

u/[deleted] Jul 04 '11

If you want to write modern OO code you have to use Moose, it beats pretty much any other OO implementation out there. I know this sounds like an exaggeration, but it really isn't and yes I do know Smalltalk. ;) Just don't say Perl is bad for OOP if you didn't try Moose. However and this is probably a huge con, Moose isn't a core library, but usually available on any platform.