Live data from Hacker News

Ask HN: Why Python over Ruby?

news.ycombinator.com

41–50 of 198 posts

Re: Ask HN: Why Python over Ruby?

#41
post #38
post #28

Earlier quoted context omitted.

"I love string methods. Not sure if Ruby also has them" What do you mean? Of course Ruby has a String class and plenty of methods on it, but I'm not sure if that's what you're talking about. Ruby comes with an XML library standard, sure, but it's pretty bad. In my experience most people use competing libraries, of which there are several high quality options. You can get a walkable tree from the core library but you'…

The "XML library" that comes with Ruby is REXML, which uses only regular expressions to 'parse' XML into the tree structure that it exposes via its API. It is a stinking pile of shit.

Sure is! Actually, I can't even remember if it has the functionality nailer's talking about. As far as I know all rubyists permanently abandon REXML approximately 20 minutes into their first coding session involving anything to do with XML.

Gets to the point where other libraries are so common that they may as well be in core, though. I wonder if there's any rubygems installation anywhere that doesn't have hpricot.

Re: Ask HN: Why Python over Ruby?

#42
post #36
post #28

Earlier quoted context omitted.

"I love string methods. Not sure if Ruby also has them" What do you mean? Of course Ruby has a String class and plenty of methods on it, but I'm not sure if that's what you're talking about. Ruby comes with an XML library standard, sure, but it's pretty bad. In my experience most people use competing libraries, of which there are several high quality options. You can get a walkable tree from the core library but you'…

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. Ask again in a couple of years!

The flipside of this, though, is that everything in Ruby is currently in a state of flux. The "winner" of the libraries is constantly changing and the rate of progress is actually quite staggering. There's excitement, momentum and willingness to embrace new ideas in the Ruby community that seems to exceed Python's.

So yeah. If you want stable, mature libraries that you can rely on for the next 5 years, Ruby is probably not the choice for you right now. If you want, however, to constantly live on "the edge" and see, say, 5 competing interfaces to the latest DB come out within days of its alpha release then Ruby's the go.

This is all fairly minor though - they're both great languages with great communities, I don't get all this "A vs. B" nonsense. There are certain libraries in Python that I wish were available in Ruby. There are certain libraries I like in Ruby that I know are not available in Python. My advice to a novice would be to choose the one whose syntax they prefer.

Re: Ask HN: Why Python over Ruby?

#43
post #23

Python is older, and gained popularity before ruby. That's why it's more established outside of the web development frameworks space.

How does python compare to ruby in terms of web development? I get the impression that there are more 3rd-party libraries in Ruby, so it is easier to get web code up and running with ruby.

See http://rubyonrails.com and convince yourself :)

Re: Ask HN: Why Python over Ruby?

#44
When you say "win", are you meaning in the sense of "there can only be one"?

Why limit the discussion to Python and Ruby? Why not include PHP, say? Why have Python and Ruby "lost" to PHP? What about C++, Java and C#?

Heck, VB is still more "popular" than either: http://www.tiobe.com/index.php/content/paperinfo/tpci/index....

Re: Ask HN: Why Python over Ruby?

#45
For embedding and scripting, I'd take python too. It'a s known value here, and I've heard ruby isn't so much.

When NOT talking about embedding or scripting, I'll probably take ruby.

Re: Ask HN: Why Python over Ruby?

#46
Both have their uses. I was a Perl hacker so Python was the obvious choice for me - but I would use Ruby for specific projects, for example if I desperately wanted a one-off app that primarily depended on a stable Ruby library where no Python one existed.

Re: Ask HN: Why Python over Ruby?

#47
post #4

I haven't really looked at Ruby that hard, but from my perspective as a reformed Perl user I found Python's syntax to be very clean and well organized. On the surface ruby looks more Perl-like to me, more clutter, not as easy to read as Python. Having found Python, I really don't feel a pressing need to learn another scripting language. Instead I'm working on Objective C.

Although I'm a Python programmer, I urge you to take at least a cursory look at Ruby. It's actually very different from Perl. Ruby borrows some stuff from Smalltalk. You know what other language borrows heavily from Smalltalk? Objective-C :)

Part of what makes the difference is cultural. It is of course possible to write very legible Perl code, but that was, at least for a time, far less visible than the "cool hack in 1 line of extremely dense code" culture, and all the "more than one way to do it!" stuff. Ruby can be messy, but there is a tendency to keep a lid on it.

Re: Ask HN: Why Python over Ruby?

#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 annoying attribute. It seems like not a day goes by without some eager Ruby programmer hacking together yet another block-based API that kind of, sort of looks like Smalltalk if you squint enough, uploading it to GitHub or some similar site, and then slapping the "DSL" label on it, because Ruby, apparently, is just too cool and powerful a language to have mere "libraries" or "APIs."

Re: Ask HN: Why Python over Ruby?

#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.

Re: Ask HN: Why Python over Ruby?

#50

For me it's very simple ! I can READ other people's Python code with greater ease than Ruby, Java, C#, C++ or even C. At the end of the day, the quicker I can assimilate library code the quicker I can use it well and the quicker the module gets completed and fully tested. Of course, with Google and Eric Raymond raving about it, the confidence factor increased further.

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.
Post reply on HN