Live data from Hacker News

Why do programmers prefer Python over Ruby?

news.ycombinator.com

21–30 of 31 posts

Re: Why do programmers prefer Python over Ruby?

#21
Readability. If I'm working in a team, it's generally the number one concern for any language I'm using, but even if it's code that I know nobody else will ever touch, there's a great comfort in knowing that I won't have to spend too much effort figuring out what I was thinking when I'm reading year-old code.

Re: Why do programmers prefer Python over Ruby?

#22
post #18
post #15

Earlier quoted context omitted.

Hmm... Could you recommend some resources for this? I need to wrap a couple libraries and make them accessible in both Python and Ruby.

The best thing to do is to take a look at the Cython docs ( http://cython.org/ ) and check out some of the whitepapers they have posted. There is also a bunch of cython code on github. If you search "cdef extern" you should find examples where other people have wrapped external c libraries.

Thanks!

Re: Why do programmers prefer Python over Ruby?

#23
post #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 tha…

I've been using ruby for about 5 years now and there is no championing of the language. There is however some sort of deep resentment towards anything ruby on most social news sites (hn not included) due to said perceived notation - this I don't understand I personally use what tool works best in a given situation.

Re: Why do programmers prefer Python over Ruby?

#24
post #21

Readability. If I'm working in a team, it's generally the number one concern for any language I'm using, but even if it's code that I know nobody else will ever touch, there's a great comfort in knowing that I won't have to spend too much effort figuring out what I was thinking when I'm reading year-old code.

This is moot you're not writing a low level math library nor are you using some archaic programming language, readability is relative and it's between the chair and the keyboard that defines that value. You can write unreadable code in python just the same as you can in ruby.

Re: Why do programmers prefer Python over Ruby?

#25
post #21

Readability. If I'm working in a team, it's generally the number one concern for any language I'm using, but even if it's code that I know nobody else will ever touch, there's a great comfort in knowing that I won't have to spend too much effort figuring out what I was thinking when I'm reading year-old code.

This is moot you're not writing a low level math library nor are you using some archaic programming language, readability is relative and it's between the chair and the keyboard that defines that value. You can write unreadable code in python just the same as you can in ruby.

You're right in a sense, but I strongly disagree.

The trick is to write readable code, and Python encourages that at every step. The Python mantra is "don't be clever". Compared to Ruby, where developers routinely vie for the most clever way to do something that may or may not (and usually isn't) in the interest of readability.

Also, the significant whitespace enforces the readability of Python vs. something like Perl, which is a very information-dense and, in the opinion of myself and many others, a substantially less readable language.

Either way, for my money, having used both languages extensively, Python proves to be more readable over the long haul. YMMV.

Re: Why do programmers prefer Python over Ruby?

#26
One point is that the python eco-system covers a lot more ground. Ruby and the ruby eco-system basically only focuses on web development, if ruby has other strength the community is pretty quite about it.

Python is also pretty good at web development, but is also excellent at scientific computing and visualization, data processing, statistical analysis (including nice bindings to R), network servers using twisted, natural language parsing, GIS analysis, computer vision and image processing and so on. Python also has Cython which makes it trivial do use C to speed up crucial functions.

Basically I prefer python because I can use the same language for everything I need and want to do.

Re: Why do programmers prefer Python over Ruby?

#28

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.

> until it was added to most languages, the scaffolding held me in awe...

I'm not sure what you mean by "the scaffolding", could you please explain?

Re: Why do programmers prefer Python over Ruby?

#29
I know that you are asking why Python might be better for some uses, so pardon a little tangent:

About 7 years ago I tried really hard to get into Python because someone I know at Google really liked the language, and I needed to pick up a better scripting language (I dislike Perl). I used Python a lot for about a year, reading a few books, using it for a lot of small projects. Python was nice!

Then I started looking at Ruby, and for me it was programming language love at first sight. I can not justify my strong preference for Ruby on technical grounds, rather I simply prefer it. Ruby is no longer just a scripting language for me (although I write a lot of 20 line Ruby programs just to get stuff done).

So, I would argue that you should choose either Python or Ruby based on your personal gut feel, after spending time with both languages. The only exception to this advice is if you want to work for a company that prefers one over the other.

Re: Why do programmers prefer Python over Ruby?

#30
post #26

One point is that the python eco-system covers a lot more ground. Ruby and the ruby eco-system basically only focuses on web development, if ruby has other strength the community is pretty quite about it. Python is also pretty good at web development, but is also excellent at scientific computing and visualization, data processing, statistical analysis (including nice bindings to R), network servers using twisted, na…

I would second this, in my $DAYJOB which is focused on building search engines, python is one of the goto languages alongside R for doing a lot of exploratory stuff.

Sure ruby could, but it would have to play catchup adding things like sage, cython, numpy, scikits etc etc

Post reply on HN