Live data from Hacker News

Ask HN: Why Python over Ruby?

news.ycombinator.com

61–70 of 198 posts

Re: Ask HN: Why Python over Ruby?

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

I totally agree about picking the languages you want to learn. There's only so many hours in the day, and you will have different pref's on style and language design, anyway.

I'd love to learn Scala (after being a Haskell and Ruby fan for years) but finding the time is incredibly difficult...

Re: Ask HN: Why Python over Ruby?

#62
post #13

Earlier quoted context omitted.

Performance has always been a finger in Ruby's eye, but with 1.9 that doesn't seem the case. Regarding libraries; you are right. Ruby has a lot of code out there, but much of it is in random repositories maintained by random people. Hopefully this changes.

Though it must be said, rubygems is miles ahead of anything available for python.

I'm not convinced that's true, as the depth and quality of rubygems are inferior to the depth and quality of eggs available in python. Find me e.g. a "gem install scipy" equivalent for Ruby.

However - "easy_uninstall scipy" REALLY needs to work!

Re: Ask HN: Why Python over Ruby?

#63
post #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 genera…

Also Twitter is lately moving to Scala because of Ruby's annoyances.

Re: Ask HN: Why Python over Ruby?

#64
post #56

Earlier quoted context omitted.

I have used both, Python more than Ruby. Python's iterators are more usable in many situations than the Ruby block system. I can return an iterator, stick it in a variable, call another function with it that returns another iterator, and so on. Python's classes also seem cleaner and less magical than Ruby's. For example, a method on a class is just an attribute that happens to be a method. Much more intuitive than Ru…

Everything is an object in Ruby, including the blocks. I'm not clear how you can't pass around a block -- or is it the block + iterator metadata you're talking about? I suspect that's just an experience problem, where Python promotes iterators over lambdas so lends itself to a different style of programming; I'm not sure how often you'd want/need to pass a full iterator around in Ruby. Personally I find blocks far mo…

It might well be experience, I haven't used ruby a great deal. I wanted to do something similar to izip in Python and couldn't see a way to do that without constructing lists in Ruby.

I completely disagree with having to write lots of boilerplate and java-esque code. I've written huge amounts of Python, and seeing Java after that really made me wince. What does Python lack that makes you feel you need boilerplate?

I don't think the one-way-to-do-it thing is that dogmatic, really. It does make code nicer when you don't have to be aware of various aliased methods, and there are less ways of making identical code look different.

Re: Ask HN: Why Python over Ruby?

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

What is this, bring out the Trolls day?

Ruby does in fact both have libraries and APIs (hyperbole aside). But none of what you've described is a reason why Python has become more prevalent than Ruby. This is just your personal bone to pick over nomenclature used by the Ruby community.

Rails is not the only piece of software in the Ruby community, and definitely not the most well designed (although it too is being improved significantly both in consistency and cleanliness in the push to 3.0).

Re: Ask HN: Why Python over Ruby?

#66
post #14

Personally I like generators, generator expressions and list comprehensions much more than the Ruby equivalents (chaining each/filter/etc). Python is cleaner overall, and if you want metaprogramming you can still do a lot of it. Also Python has better libraries and runs on App Engine.

I'm too big fan of iterators, they're great!

Although it's worth noting that Ruby too, runs on GAE using JVM based implementation (JRuby).

Re: Ask HN: Why Python over Ruby?

#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 developers for your code-base.

Likewise, I believe Python 3000 is unlikely to used in Google for the forseeable future, due to that same code investment. I don't think Python 2.6 is fully supported, either...

I don't think "a bit more beginner friendly" is truly accurate. Most beginners will look for doc's and books, and for a good few years, recently, there was a dearth of good Python books while there seemed to be a new Ruby or Rails book every month, including several allowing you to d/l them for free.

I have to admit that I used to recommend Python to beginners for a long time, as it helped them avoid developing bad habits with the other equally popular "beginner" PHP and Visual Basic languages. These days, it's a toss-up.

If the person talks about writing web-apps, I'll tend to recommend Ruby and Rails as it has earlier ROI for a beginner, therefore a lot initially more satisfying.

Re: Ask HN: Why Python over Ruby?

#68
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 the documentation, people generally pointed to the pickaxe book as the de facto documentation.

Re: Ask HN: Why Python over Ruby?

#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

Re: Ask HN: Why Python over Ruby?

#70
post #34
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 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 out simple coding examples proved as frustrating when things didn’t do what you’d suppose they’d do...

(http://www.bitwisemag.com/2/What-s-Wrong-With-Ruby)

I actually gave Ruby a shot, going through the interactive tutorial on http://tryruby.hobix.com. I couldn't do it very long, however, because it was completely ridiculous. In what world does it make sense for hash keys to double as string grep? For instance:

    my_string['foo'] = 'bar'
will replace the first instance of foo in my_string with bar?! WHY?! I can stick an exclamation point on the end of method calls... to signify mutation? WHY?! What twisted logic allows one to rationalize multiplying strings like:

    "5" * 2 == "55" 
yet throw an exception for:

    2 * "5"
It makes absolutely no sense! And why would an integer have a method for converting itself to a string? Or an array? I found so many things in Ruby that made me think, "Okay, superficially that's really convenient and sorta cool... but it makes no sense and it is absolutely counter-intuitive. And I feel dirty using it, even if everybody is doing it." Some people, I assume, find Ruby to be "elegant" for the same reasons I find it to be "an abomination."
Post reply on HN