Live data from Hacker News

Ask HN: Why Python over Ruby?

news.ycombinator.com

21–30 of 198 posts

Re: Ask HN: Why Python over Ruby?

#21
Having used Python a while, unnecessarily marking out statements a second time for the computer using brackets is a waste of time, and ugly. I use older faster languages and put up with this, but don't see the point of doing so with Ruby.

Nearly all of the installers and packaging formats and management tools in Linux have Python APIs.

Edited as I wasn't clear the first time round: I love Python's wide variety string methods, and the emphasis people put on these rather than using RegExs all the time (sorry, I have more Perl and less of a Ruby background). Looking further it seems there's Ruby equivalents of most of my frequently used methods.

I love etrees in the standard library. People who use regexs for dealing with tree structured data are mental. Again, perhaps a Roby fan might enlighten me if there's a similar data structure in Ruby, I wouldn't be surprised.

Re: Ask HN: Why Python over Ruby?

#22
In Python you dont' have to type 'end', just kidding although for some reason it reminds me of VB for this reason. I wish it didn't but it does. Why have an end be anymore than 1 character on a serious note, that is lots of keystrokes extra not needed.

But more seriously Python is a growth like Javascript. It has grown and adapted to every change it has been required because it has a very rapid iteration time and is great for wrappers to core C. It is clean and maintainable.

For this it has made huge inroads to system administration, game development, tool plugins, web development, command tasks and everything else. I have yet to have one instance where there weren't numerous libraries for every task. Even if you don't want to use a third party library there are many examples of how to do it.

Python is really at it's core many things. It is a functional language, it is an OO language and it can be procedural. It can wrap intense lower level libraries or port in a C extension for speed. The same code you wrote for your desktop api, can be used in a desktop app, a service, website, a web service, a tool plugin, at the command line or any way you need it.

It can float like a butterfly and sting like a bee.

Like Javascript, Python is based on a core few types, lists and dictionaries (objects). All the languages that seem to permeate like viruses have this basic computer science fundamental. It just is as simple and clean as you can get. Ruby also has this but it came a bit later.

And finally, it is named after the great Monty Python.

Re: Ask HN: Why Python over Ruby?

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

Re: Ask HN: Why Python over Ruby?

#24
Why language X is better of Y makes no sense. Every language has its benefits and downsides. Python has been slighly longer around and has a bigger user community which resulted in more available library code. Ruby and Python is pretty much interchangable in the sense of features as they often steal from each other and vice versa.

Ruby

- follows TIMTOWTDI

- Mutable strings etc.

- has a greater emphasis on code generation ("meta")

- VM's are much slower than Python (there is no Psycho etc.)

- emphasizes code clearity and readabiliy (human cycles are more important)

- Libraries are much less mature

- ...

The lists of differences could go on forever. A comparsion and "why" is difficult. I think they are too similar and the people are too polarized.

A language is a tool to solve a particular problem. In the case of Python you have higher momentum of the community and the switch from C/C++/Java to Python is often easier than to Ruby. (Wild statement of me with tests from a sample set of 2 test subjects ;) )

Probably the best characterization I can come up with is. Python is already on this "Enterprise" trip where companies use it a lot and so forth. Ruby has some interesting companies pushing it (Twitter etc.) but is not compeletely there yet, it still has more "hacker" and "monkeypatch" feeling. Oh wait, we call that "ninjapatching" in Ruby ;)

Re: Ask HN: Why Python over Ruby?

#25
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…

"..strange ad-hoc combination.."

For instance?

Re: Ask HN: Why Python over Ruby?

#26
I chose Ruby mainly because of all the syntactic tricks and weirdness but despite slowness.

You might choose Python for exactly the same reason; e.g., I wouldn't use Ruby on teams with >2 developers, especially in Google. Python is more straightforward but at a (small) price of freedom.

Example: you can rapidly prototype in Ruby using blocks and extend basic classes (even integer) using monkeypatching. I was fascinated by this, yet I wouldn't monkeypatch when working with other people so that advantage goes out of the window.

Re: Ask HN: Why Python over Ruby?

#27

One major problem with Ruby has been that the performance as been much slower than Python. This is no longer true with Ruby 1.9. I happen to have done a benchmark using a recursive Fibonacci algorithm yesterday, results: http://pastie.org/528717 source: http://pastie.org/528720 I wouldn't say Ruby has lost just yet.

Just using Fibonacci for testing out VM performance is a bad idea. You need a broader viewpoint. That said, every language shootout is basically rubbish as there are so many variables who play into this.

http://shootout.alioth.debian.org/

Re: Ask HN: Why Python over Ruby?

#28
post #21

Having used Python a while, unnecessarily marking out statements a second time for the computer using brackets is a waste of time, and ugly. I use older faster languages and put up with this, but don't see the point of doing so with Ruby. Nearly all of the installers and packaging formats and management tools in Linux have Python APIs. Edited as I wasn't clear the first time round: I love Python's wide variety string…

"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'd be better off with one of the superior third-party libraries like hpricot or nokogiri.

(edited badly written original)

Re: Ask HN: Why Python over Ruby?

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

Post reply on HN