Live data from Hacker News

Ask HN: Why Python over Ruby?

news.ycombinator.com

71–80 of 198 posts

Re: Ask HN: Why Python over Ruby?

#71
post #69
post #16

I prefer the design of Python over Ruby. I'd be hard pressed to explain why -- something vague about Python being straightforward yet graceful -- but that aesthetic preference is enough to sway me.

Me too, but I don't think it's just a preference. I come from a C/C++ background (I'd say the majority of people do, or C# or Java), and Python looks much more familiar and obvious to me than Ruby. For example, this from Wikipedia: (3..6).each {|num| puts num } Has some funny brackets and pipes. In Python, it's much more familiar to C-ish folks like me: for i in range(3, 7): print i

Ruby's syntax is flexible:

  for i in 3..6 do
    puts i
  end

Re: Ask HN: Why Python over Ruby?

#72
post #49
post #15

Python is far more mature, isn't a strange ad-hoc combination of other languages, has a third-party library to do anything and everything (which is probably also reasonably mature), and doesn't have a community rife with arrogant children. I'm generalizing to some extent, of course, but these are the things that I and other developers I know associate with Ruby (including many who's startups are built on it). I imagi…

... a community rife with arrogant children It's difficult to accept your rational argument when you include stuff like this.

Why is that? It can easily be proven. I'm not trying to suggest that everyone who uses Ruby is an arrogant child as I even have friends who certainly don't fit that bill, but when you have an especially abrasive attitude like that within a community, it only takes a minority to sour the majority.

And while it certainly isn't a fault of the language, it definitely influences it usage for some people.

Re: Ask HN: Why Python over Ruby?

#73
post #42
post #36

Earlier quoted context omitted.

You're right, that was ambiguous, I've edited my post to clarify. The behavior I'm referring to is loading XML into a tree shaped data structure, so you can reference particular branches when seeking or adding content, and not have to think about about tags (well, once you'veran it though BeautifulSoup or a similar cleaner).

That's OK, my reply was also pretty ambiguous :D I am not really familiar enough with Python to say for sure but from what I know, XML libraries are probably superior on the Python side - in fact most "enterprise" interoperability libraries are probably better, or at least more mature. The situation on the Ruby side is improving rapidly, but given its history, yeah, many things like that are probably a little behind.…

Python has similar issues tho - look at unit testing. The standard library has unittest, everyone prefers nose.

Re: Ask HN: Why Python over Ruby?

#74
I like Ruby (culturally) more than Python.

Python has NumPy/SciPy/and friends, so I use Python.

This, I feel, is a strong point for most who are using a scripting language to do scientific work.

Re: Ask HN: Why Python over Ruby?

#75
post #50

Earlier quoted context omitted.

This is a cultural issue. In the Ruby (or Perl) community, if you use obscure language features to do a common task in a single line of code, you will be worshipped as a god. In the Python (or Tcl) community, you will be viewed with suspicion. Not that Python doesn't have one-liners (e.g. comprehensions) - just that everyone agrees which ones and when and how to use them.

I've been working in Ruby for 3 years now, and i can promise you that unclear code is very much not appreciated by not only the people i work with, but all of the open source projects i'm involved with. It is true that Ruby gives you a lot of rope. People with good design sense appreciate that your code should not be too clever.

Agreed. The ultimate goal is clarity. Everything else is subservient to it.

Re: Ask HN: Why Python over Ruby?

#76
1. Get latest OpenSolaris. 2. Install latest SunStudio 3. download latest source of Python (3.1) and Ruby (1.9.1). 4. Try to build them with CC=/opt/SUNWspro/bin/cc" CFLAGS="-m64" 5. See the results. Run make test for ruby.

Re: Ask HN: Why Python over Ruby?

#77
post #69

Earlier quoted context omitted.

Me too, but I don't think it's just a preference. I come from a C/C++ background (I'd say the majority of people do, or C# or Java), and Python looks much more familiar and obvious to me than Ruby. For example, this from Wikipedia: (3..6).each {|num| puts num } Has some funny brackets and pipes. In Python, it's much more familiar to C-ish folks like me: for i in range(3, 7): print i

Ruby's syntax is flexible: for i in 3..6 do puts i end

Very flexible. Once you learn what the sytnax means the implementation of blocks and iterators is one of the best parts of the language.

    3.upto(6){ |x| puts x }
I don't think the uniqueness of a language is any reason not to learn it. To be honest that sounds lazy.

PS I'm not a Ruby zealot, and Python is a great language

Re: Ask HN: Why Python over Ruby?

#78
post #55

Ruby has clever syntax. Python has pure syntax. Ruby has method aliases. Python does not allow a string to capitalize itself. Ruby uses Ruby methods within Ruby classes to extend Ruby. Python has decorators so you can write functions that return functions that return functions to create a new function. Ruby has strict object-oriented encapsulation. Python is laid-back about objects, because you probably know what's g…

Python's C implementation is so clean..

just try to compile it on OpenSolaris with Sun compiler.

hint: Perl or Ruby were passed 100% tests.

Re: Ask HN: Why Python over Ruby?

#79
post #67
post #19

Python has IMHO better support for GUI toolkits - Tk support in main library, PyGTK+, PyQt. And two more words about library - import antigravity :). And strong company backing: Google has have hired some of the core Python developers, and some of its infrastructure is written in it... Flumotion with its streaming media (although codec stuff is mostly gstreamer, but most of the networking stuff is in Python) And the…

People should be careful how much they quote Google as their reason for preferring Python. The main reason was when they were standardising on the core-languages they could support, Python was enormously far ahead cf. the competition, so it was an obvious choice. And now, with all that code investment, you do NOT want to start again. And if you have the money, of course you'd be interested in hiring the best develope…

This is somewhat tangential, but I'm pretty sure that Google re-writes the search code ever few years.

Re: Ask HN: Why Python over Ruby?

#80
post #48

Using edge cases in the syntax to construct an API with unusual calling conventions is not "writing a DSL." Unless you build a compiler/translator for it, it is not a "DSL," it is plain-old Ruby, happily accepted by any conforming Ruby implementation--nothing more. After their pretentiousness, their arrogance, and their vociferous obnoxiousness, I find their misuse of this once-widely understood term to be their most…

Er, wrong.

Granted most things people call DSLs frankly are not, an internal DSL is a well known concept and repeatedly implemented in a lot of languages.

Post reply on HN