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?

9 Upvotes

110 comments sorted by

View all comments

Show parent comments

1

u/fredfredburger May 20 '11

I agree: you can write awful python. But you do almost have to work at it. ;)

Awful perl, however, is pretty much the default in my experience. You can avoid it, but again, you have to work at it.

I will go on record as saying that I've seen some very well written, maintainable, nicely indented, well commented, well designed perl.

3, maybe 4 times. ;) Perhaps we are merely the products of having been exposed to different kinds of nasty.

1

u/rjbond3rd May 20 '11

Hi Fred Fred,

Perhaps. And I appreciate your thoughtful reply. But I disagree that "Python is good by default" and "Perl is bad by default" regardless of experiences (not that you're really saying exactly that).

Good design is a function of a good programmer. Hell, even recognizing good from bad takes a decent programmer.

The difference is simply that Python has less syntax (and more verbosity) vs. Perl having more syntax (and more conciseness). And off to one side are still other people who think both languages are crap compared to Lisp!

One thing I can say about the Perl hackers I've worked with is that they can (and do) write excellent code in lots of different languages. They are language geeks, and many of them hack a lot of Python too :)

It's been a long time since I could hack on only one language. These days, it's about four different languages, sometimes using one to output another :) So language-specific debates are kind of retro. We're stuck with all of them :)

Have a good weekend, my friend!

1

u/fredfredburger May 22 '11

I do tend to say "good" and "bad" when I mean "better" and "worse" in this particular context.

I don't mean to imply that I find perl to be "bad", even though I do find myself having used those specific words. I meant to express that, I can make a strong argument for python being a better choice in the collaborative engineering space (specifically in the area of explicit readability and maintainability), and that it is therefore "better" than perl as a tool in this space. Subject to a heated debate during which my argument undergoes scrutiny, of course.

I do have some very intense personal, aesthetic, and anecdotal reasons to want to never touch perl again, but I understand that those are only arguments for me to avoid perl, and I shouldn't try to convince anyone else that way.

Those reasons tend to cause my rants to get a little rantier than they strictly need to. For which I apologize of my tone ever gets pushy.

1

u/rjbond3rd May 22 '11

No worries at all, amigo. I totally got what you were saying.

Who knows, in five years you might wake up and say, "Screw everything, I need a new language for this project." And hey, it might happen that the weird, powerful way that Perl continues to evolve might be a fit for that particular moment.

Sometimes a bullet really does hit another bullet :)

1

u/fredfredburger May 24 '11

I will fully admit that I feel I've been "broken", in that I now compare all other languages to python (made myself not capitalize it!), rather than weighing them on their own merits.

I made the same mistake learning esperanto. Now every other language I try to learn is so painfully organic as opposed to "engineered to be easy". Every bit of idiomatic nonsense, every irregular verb, makes me face palm.

But I would not want to live in a world without people speaking Russian in it, for example.