Hacker News new | ask | show | jobs
by webmaven 3638 days ago
I'm a mostly Python / occasionally Ruby web developer.

There isn't much you're missing. About the only use-case I can think of where Ruby has a clear advantage is in creating a DSL.

Other than that, there are differences in what already exists in the two ecosystems, but (at least for web development) generally there are equivalents available (eg. Nokogiri vs. BeautifulSoup). The Rails and Django frameworks are roughly comparable, for example, with Rails being more 'magical' vs. Django being more explicit. Which one is better for you may just come down to your personal tastes.

Now, outside of web development, Python has a clear advantage in areas such as scientific computing, game development, machine learning, and many other areas in which Ruby doesn't really have much of a presence. This isn't due to any inherent quality of the two languages, just historical contingency, as Ruby's emergence from obscurity was a result of Rails taking off, whereas Python grew a large and eclectic user community (of which web development was a small part) more slowly, but starting years earlier.

3 comments

> There isn't much you're missing. About the only use-case I can think of where Ruby has a clear advantage is in creating a DSL.

But whether or not creating a DSL is a good idea or not is a whole nuther question. I find that there is a cost to all the Ruby features that make DSLs easy.

If I may make some sweeping and possibly trite generalisations between the Python and Ruby communities... Ruby fans value the happiness of the programmer writing new code, while Python fans value the happiness of the programmer having to read or debug someone elses code.

Typical Ruby projects often go to great lengths to provide an elegant API even if it makes the internal implementation more complex. Typical Python projects seem to prefer clearer simpler implementations at the expense of a slightly clunkier (compared to Ruby at least) API.

I don't know if Pythons "consenting adults" attitude about not hiding internal details contributes to this. eg private methods are a language feature in Ruby (and most other languages), but just a non functional naming convention in Python.

There's probably also something to do with Rails being a formative philosophy for a lot of Ruby coders. Ruby coders from outside the Rails world often seem value more explicit code with less desire for complex 'magic'.

Also, while ruby may be better at DSLs, python's not bad at them by any means. All the __magic_methods__ that enable stuff like operator overloading and intercepting "obj.attr" references, etc make it pretty easy to make a pretty reasonable looking DSL pretty quickly.
> About the only use-case I can think of where Ruby has a clear advantage is in creating a DSL

Yep. Chef and Puppet (machine configuration tools) are written in Ruby.

Ansible is written in Python and they didn't have to invent a DSL to make it work ;)
Ansible is written in anything that generates json
Ansible itself is written in Python, but yeah, the plugins can be written in pretty much anything.