Live data from Hacker News

Why do programmers prefer Python over Ruby?

news.ycombinator.com

1–10 of 31 posts

Why do programmers prefer Python over Ruby?

#1
I'm a Ruby programmer. Recently there was a poll about everyone's favorite programming language and Python came out ahead over Ruby. To me, Python seems to lack some of the niceties that Ruby has like blocks and it also seems to have some superfluous stuff like having to pass self into each method. I'm not trying to ignite a flamewar but rather I am genuinely interested in why a programmer might prefer Python. Thanks.

Re: Why do programmers prefer Python over Ruby?

#2
Well, for me, it's readability and maintainability. I find Ruby unreadable, and if I want to hire a programmer, it's easier to take a Perl, PHP, or even C# developer and teach them Python than it is to teach them Ruby, at least from my experence.

I don't think there's anything wrong with Ruby as a language, and until it was added to most languages, the scaffolding held me in awe...

I just prefer Python's readability.

Re: Why do programmers prefer Python over Ruby?

#3
As a scientific programmer, I like python because I'm used to it, because there are a wealth of useful libraries and packages that suit my needs, and that it can be "fast" (if you know how to take advantage of the underlying c code and use numpy whenever possible; and the obvious fast-prototyping advantage over compiled languages). I don't have much experience with Ruby so this is by no means a diss of the language. Its just why I have stuck with it for so long

Re: Why do programmers prefer Python over Ruby?

#4
I've done some programming in Python and am currently learning Ruby.

One of the differences I see is Python's philosophy of having one, correct way to do things, while Ruby supports having multiple ways. This difference in philosophy seems to be clear in the language design. Python usually has one or two accepted ways to do basic tasks, while Ruby has more.

It's a little frustrating because in Ruby, I have to remember different syntax and constructs for doing the same basic thing. I'd much rather just have to remember one way, and expect other people's code to use that one way (ie, Python is more readable).

Python also seems to have a larger community and more well-developed/useful libraries and tools. I don't think NumPy and SciPy have equivalents in Ruby.

Also, even though Ruby says it advocates the principle of least surprise, I'm often surprised by Ruby, and much less so by Python.

Re: Why do programmers prefer Python over Ruby?

#5

Well, for me, it's readability and maintainability. I find Ruby unreadable, and if I want to hire a programmer, it's easier to take a Perl, PHP, or even C# developer and teach them Python than it is to teach them Ruby, at least from my experence. I don't think there's anything wrong with Ruby as a language, and until it was added to most languages, the scaffolding held me in awe... I just prefer Python's readability.

Good point! Python is very nice to read

Re: Why do programmers prefer Python over Ruby?

#6
I'm going through Ruby koans right now but am a Python programmer.

The #1 thing I like about Python is the community and has nothing to do with the language. I find the python community doesn't actively champion the language as the end all be all (for better or worse). Rather it is accepting of when Python sucks for a specific task.

I also find Ruby to be really web focused. Python tends to have lots of libraries that are not solely for web based needs. Not to say Python doesn't have web stuff...there is so much I can't even keep up.

Re: Why do programmers prefer Python over Ruby?

#7
Disclaimer: This is very subjective and from a Python guy

1. While Python and Ruby are roughly of the same age, Ruby was only popular in Asia before Rails. At that point Python already had a solid base of non-web stuff.

2. Ruby feels more wild and crazy to me. Is monkey-patching still considered cool in the Ruby community? As a Pythonista I try to avoid such confusing stunts.

Due to both of those reasons I believe Python has more solid libraries. For example, Rails was extracted from a small productivity app, while Django was extracted from a serious newspaper website. While Ruby was fixing memory leaks, the Python interpreter was speeding up its hash map.

As a language enthusiast I envy Ruby for the blocks. As a Python programmer I never felt the need for them.

Re: Why do programmers prefer Python over Ruby?

#9

Well, for me, it's readability and maintainability. I find Ruby unreadable, and if I want to hire a programmer, it's easier to take a Perl, PHP, or even C# developer and teach them Python than it is to teach them Ruby, at least from my experence. I don't think there's anything wrong with Ruby as a language, and until it was added to most languages, the scaffolding held me in awe... I just prefer Python's readability.

I agree. I am a PHP developer and just started learning Python a few days ago and must say, for now, it is indeed easy to learn and is very readable. Though I never tried Ruby so I can't tell you if I would find that easy also.
Post reply on HN