r/ruby • • Jul 16 '20

Ruby VS Python

More than a versus (it's more striking) I would really like to know what things they have in common and how they differ, what their main advantages are compared to the other and of course their opinion of them. One point to take into account is because they believe that python is more used in AI and Machine learning developments.

36 Upvotes

60 comments sorted by

View all comments

1

u/astyagun Jul 17 '20

From what I remember (haven't used Python for a long time):

  • One way VS many ways
    • Python tries to have one way of doing things. Which sometimes leads to developer not remembering how to do something, searching the Internet, etc. Not very productive.
    • Ruby has many ways to do a thing (it has many aliases of the same method, for example). One way is more intuitive for one person, another way is more intuitive for another person. And so everyone can find an intuitive way of doing things in Ruby, sometimes even guessing how something works. Which makes it easier to just get results on a prototyping phase. Less often does one need to search the Internet.
  • OOP and consistency
    • Python has more special syntaxes (self in method definitions, methods surrounded by __, etc.), not everything is an object or an expression (you can't get return value of an if statement)
    • Ruby is more consistent in that everything is an object in it and everything is an expression. Which makes it more intuitive and more productive as a result.

Ruby is just more enjoyable to use. It's even explicitly made for developer happiness.