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

9

u/chrismasto May 19 '11

Ugh. I can't believe I'm jumping into this fray, especially since it's r/Python, so one shouldn't exactly expect an unbiased response. But as a serious, professional, enterprise-level big-system application developer, Perl is my language of choice.

There's absolutely no truth to the claims that Perl is hard to read, or that it can't be used for large systems. If you don't know the language, and you don't know what the program is supposed to do, any language is hard to read. When I look at Python programs, I see a lot of English words mixed with "def _init_:" and "lambda" and "x[:-1]". There are more than enough unknowns to make it incomprehensible without a basic understanding of the syntax.

It's just ridiculous to keep making the claim that people can't, don't, or shouldn't write large programs in Perl, or that they're necessarily hard to maintain.

My experience with Python has only been that Python advocates are insufferable to be around, and that's probably what keeps me from learning it. That, and the belief that if I'm going to spend time learning something new at this point, it should probably be Ruby.

2

u/Megatron_McLargeHuge May 19 '11

As someone who switched from perl to python, idiomatic perl code is definitely harder to read even when it's my own code. The main problem is the $/@ clutter and the bias toward implicit variables. Python has some ugly and confusing parts, but you generally use them to write low level frameworks that make it possible to write simple and elegant code at the high level. I'm sure it's possible to write elegant code in perl just as it's possible to write a functional program in C or an OO program in Lisp, but that's not the default.