Live data from Hacker News

Ask HN: Why Python over Ruby?

news.ycombinator.com

101–110 of 198 posts

Re: Ask HN: Why Python over Ruby?

#102
post #97
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." During FISL, a couple days ago, I witnessed something that really bothered me. It was a presentation comparing Rails with Seaside (which is, by itself, like comparing racing cars with subarines) and the arrogance of the Rails guy dismissing Seaside, Squeak and Smalltalk was very uncomfortable. It seemed the room was too small to fit all the egos inside it. I considered stayi…

Rails folks are like that. Even though the rest of the Ruby community is much more reasonable, the weekly Rails debacle has driven a lot of people away from Ruby, including me.

If Rails weren't around, it would be much easier to enjoy Ruby without having to use it in isolation. Then again, a whole lot of people wouldn't have gotten into it in the first place.

Ruby lived fast and died young. If you don't want to use Python, learn Haskell.

Re: Ask HN: Why Python over Ruby?

#103
post #70

Earlier quoted context omitted.

Quoting an article on the topic: Having ploughed through several tutorials, I did not find Ruby particularly "elegant", or its syntax particularly obvious. Much of it seemed ad hoc, thrown together, in particular when there were several different ways of doing something, and it seemed to be the philosophy of the language to provide all of them. I did not find its constructs as intuitive and natural as claimed, trying…

Well, I can answer at least a few of those 'WHY?!'s. Firstly starting with my_string['foo'] = 'bar', this is a syntax that is used a lot in Ruby for anytime that you wish to recover a subset of a collection - you can use it with a Dir object for example to recover a subset of directories/files, or in the case of a hash, to recover the object stored at the key. The thing is that you need to think about it as being a s…

I suppose these just seem odd to me, which was my point. Not that I find something absolutely wrong about them, anymore than I can find something wrong about a language which doesn't have mutable variables or whatever the case may be.

A lot of Ruby's conventions simply scream "ambiguity" to me. A "subset of a collection" is extremely ambiguous; if there is more than 1 foo in my_string, does it always get the first? How do I get the rest? my_string['foo'][2] or something? I can't even intuitively make something up which makes sense to me. Perhaps there isn't a way to get the others, which I suppose would be in line with Python, which doesn't supply a string method to find all occurrences at once... but how do I offset it?

I can see where standardized methods like to_a can be more convenient, but they also open up the possibility for unlimited ambiguity. What does Foo.to_a do for your Foo class? It could do anything! There's no way I could rely on these methods to do something across the board unless I know your class conforms to some Interface (do Ruby folks use/have Interfaces?). In Python, if I do

  [foo]
Then foo is now a list. I always know what I'm getting. I always know what int() is going to attempt to do to an object, etc.

Re: Ask HN: Why Python over Ruby?

#104
post #9

Ruby is slightly newer and wasn't particularly popular in the United States until it was popularized by Rails. Python became popular with Linux and open source developers before Ruby did, and has had slightly more time to develop a nice set of libraries to do just about anything.

May I also add that Python works very nicely on a Windows box. Ruby/Rails works on Windows, but when I used it, it hobbled around on one leg. Going to PyCon this past year, I was stunned at how many Windows laptops there were. Python itself and the Python community are really quite OS agnostic. The online Python documentation tends to be pretty good. When I picked up Ruby a year and a half ago, and I tried to find th…

Yes, the pickaxe book or the class docs at ruby-doc.org

Although I've been using Ruby on windows the last few weeks with Ruby Shoes from _why(normally use for unix scripts or web-dev). It's pretty nice (although a little rough around the edges as it's under heavy developement).

When you install shoes (the latest version anyway) you get the GUI tools, ruby gems, and sqlite, and a ruby interpreter, all neatly packaged. And there is a whole load of items I havent looked at yet. It's fun.

Re: Ask HN: Why Python over Ruby?

#105

From the Python website: "Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we're looking for more people with skills in this language." When I first saw this, I went "Google? Whoa. I gotta check this out" :)

"'Google? Whoa. I gotta check this out'"

I had a similar experience in '02 or '03. Then I quickly recognized that Google's decision to concentrate on Python, Java and C++ doesn't have any bearing on my companies' choices, especially since some major factors in Google's decisions (eg, dealing with a very large number of internal developers) just don't apply.

Re: Ask HN: Why Python over Ruby?

#106
post #70
post #34

Earlier quoted context omitted.

...strange ad-hoc combination of other languages. I call bullshit, sir. Ruby is objectively less strange and more consistent than Python. Some has to do with the fact that Python is older - hence has more baggage to carry. A lot of it, though, just has to do with poor/missing design choices. Specifics? - ruby 'block' passing convention is much cleaner and more powerful than python's 'for'/iterators. - python's global…

Quoting an article on the topic: Having ploughed through several tutorials, I did not find Ruby particularly "elegant", or its syntax particularly obvious. Much of it seemed ad hoc, thrown together, in particular when there were several different ways of doing something, and it seemed to be the philosophy of the language to provide all of them. I did not find its constructs as intuitive and natural as claimed, trying…

Re: "5" 2 == "55" vs. 2 * "5" == Exception*

You need to remember that EVERYTHING is an object, there are no basic/literal types at all; in this case, "5" is really just syntactic sugar for creating a "5" String object, 2 is syntactic sugar for creating the "2" Integer (Number?) object, and the " * " operator is syntactic sugar for the " * " method of the "5" String object == ' "5".times(2) ' (which is similar to Perl's ' "5" x 2 ' construct).

The String class supports a " * " method which creates n copies of it's string value, and concat's them together into a new String object, but the Integer class does not.

Many "basic" objects have explicit conversion methods, but will also frequently support implicit conversion where it makes sense.

Re: Ask HN: Why Python over Ruby?

#107
post #100

What's clear to me reading the comments in this thread, is that there are a lot of people who like Python, and don't understand what people appreciate in Ruby. None of these are reasons why people choose Python over Ruby. Or why Python has become more popular. It is worth noting that Python was also mentioned a lot as a teaching tool when its popularity began ramping up, and some universities have replaced Java and S…

To claim that Ruby is a tangled soup of options and syntactic sugar is to miss the point really. What is the point? I sincerely wish to learn, for my own intellectual curiosity. Because I have read Ruby code and I have done Ruby tutorials and talked to people who use Ruby and for the life of me, no matter how hard I meditate on the issue, I cannot understand why anyone would use Ruby over Python. I don't feel Python…

I currently use Python and Django for the following reasons: 1) Coworker familiar with Python 2) I had an easier time understanding the mechanics of Django than I did Rails 3) Some libraries I needed were only in Python

However, from a language point of view, I have a slight preference towards Ruby. Here are some things I like: 1) More consistent commitment to object paradigm, e.g. all function calls are actually method calls on an object. In Python, everything is an object, but sometimes you use methods, and sometimes you don't, e.g. list.pop() vs. len(list). 2) I think blocks are very handy. 3) I like the more Perlish regex syntax. 4) There is a cleverness to Ruby that might not be the best thing for a corporate environment, but it makes it fun.

So, if I was writing code just for myself, I might choose Ruby over Python, assuming performance and library support were sufficient.

Re: Ask HN: Why Python over Ruby?

#108
post #97
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." During FISL, a couple days ago, I witnessed something that really bothered me. It was a presentation comparing Rails with Seaside (which is, by itself, like comparing racing cars with subarines) and the arrogance of the Rails guy dismissing Seaside, Squeak and Smalltalk was very uncomfortable. It seemed the room was too small to fit all the egos inside it. I considered stayi…

That's how I feel about Django at this point. A quick glance at reddit reveals how out of hand it's getting; the answer to every web programming question is "Django!" regardless of whether it's relevant or not. And every popular comment or blog post by Django developers discussing Rails contains a bunch of inaccuracies. At least with Rails there's enough of a push back that even the the annoying minority is better behaved, and Rails development these days is more wycats/merb than anything else. I've always liked Django, but in recent months I've been totally turned off of it, but these days it's tough to develop web apps with python and avoid django.

Re: Ask HN: Why Python over Ruby?

#109
post #12

Python got popular earlier - it was already gaining significant converts in the early part of this millennium, and the later years of the last one. Ruby only really took off when Rails started to get popular. But it has really taken off, in a way that I think sometimes makes the Python guys (who have been slowly and steadily gaining ground) a bit jealous. They're both good languages with good communities though. Each…

"But it has really taken off, in a way that I think sometimes makes the Python guys (who have been slowly and steadily gaining ground) a bit jealous."

Reality seems a bit different to me:

http://www.tiobe.com/index.php/content/paperinfo/tpci/index....

http://bitworking.org/news/413/ruby-books-sales-a-retrospect...

Re: Ask HN: Why Python over Ruby?

#110
post #96

Earlier quoted context omitted.

So I just saw 3 ways to print from 3 to 6... are those all used in the wild? Zen of Python: "There should be one-- and preferably only one --obvious way to do it." Sure, there are other ways to do it in Python, but it'd be frowned upon to use something like 3.upto(6) rather than a standard range() that everyone is used to. Readability matters.

I'd argue 3.upto(6) is much more readable and obvious than range(3, 7). Even just on a conceptual level, Python requires a degree of translation and its stop argument is not intuitive whereas even someone who has never programmed before can understand the Ruby.

http://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831....
Post reply on HN