Live data from Hacker News

Ask HN: Why Python over Ruby?

news.ycombinator.com

31–40 of 198 posts

Re: Ask HN: Why Python over Ruby?

#32
post #20
post #13

Earlier quoted context omitted.

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

Can you explain more? Is there better native packaging (deb/rpm) etc support?

Rubygems is a separate system from deb/rpm, but works roughly the same way. Typically it doesn't do binary packaging the way they do it, though, and if native (non-ruby) code is required it is compiled during the install.

Re: Ask HN: Why Python over Ruby?

#33
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://pypi.python.org and convince yourself :)

Re: Ask HN: Why Python over Ruby?

#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 functions are stranger and more ad-hoc than Ruby's strict object-orientation.

- ruby's mixins > python's multiple inheritance

- python underscore (and double underscore) naming conventions to overcome simple language features

Don't get me wrong: i love python - but primarily because of the faster execution and larger community - not because of the language itself.

Re: Ask HN: Why Python over Ruby?

#35

python is easy to learn like php and ruby have sometimes strange looking syntax like perl for newbies. A good programmer doesn't have this problem and will love the goodies and syntactic sugar from ruby.

php syntax is much more perl-y than ruby

Re: Ask HN: Why Python over Ruby?

#36
post #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'…

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

Re: Ask HN: Why Python over Ruby?

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

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 Ruby in my opinion.

I'm also fond of Python's idea that "There should be one-- and preferably only one --obvious way to do it".

I agree that Python does have its fair share of strangeness, but that fades away with time (you don't notice it).

Re: Ask HN: Why Python over Ruby?

#38
post #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'…

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.

Re: Ask HN: Why Python over Ruby?

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

Code is read more than it's written - TIMTOWTDI is a double edged sword.

Re: Ask HN: Why Python over Ruby?

#40
I wish Ruby were good, but it's so fucked:

  Matz's decision-making process
    He tries to make Ruby be all things to all people
      Lots of confusing sugar and overloading baked in
    I much prefer Guido's hard pragmatism

  The pointless panoply of function types: Methods, Blocks, Procs, Lambdas
    All intertwined and yielding into one another.
    I love that in Python there is only one:
      Objects with a __call__ method, defined metacircularly.

  The culture of adding/overloading methods on base classes
    Many gems do this en masse, and there are a lot of low-quality gems
      Seriously, Ruby might have a ton of new gems for everything, but they
      are almost universally awful. A culture of sharing any code that *could*
      be a module, no matter how trivial, leads to immature crap being widely
      used because it was there already, with a mess of forks to clean up
      afterwards. At least most of them are test-infected...
        Python does come with a few stinkers, mostly ancient syscall wrappers.
    Especially disastrous because it's unscoped, and infects the whole process
      For a language with four scoping sigils it sure fucks up scope a lot
    The syntax practically begs you to do it, anything else would look shitty

  The Matz Ruby Implementation
    The opposite of turtles-all-the-way-down (Smalltalk crushed beneath Perl)
    It actively punishes you for taking advantage of Ruby's strengths
    The standard library is written almost entirely in C
      It doesn't use Ruby message dispatch to call other C code.
      That means that if you overload a built-in, other built-ins won't use it
    Anything fiddly that's not written in C will be dog slow
Post reply on HN