Ruby vs Python, the Definitive FAQ

9,413 reads

“Python or Ruby” is the one of the most hotly debated topics in the programming world, ranking just behind “emacs or vim” and “pro-skub or anti-skub” in importance and complexity. This FAQ will showcase their differences, answer some common questions about both, and provide an objective, definitive answer to which is better.

What is Python?

Python is a type of large snake found across the southeast semihemisphere. They are nonvenomous and hunt primarily through constriction. Many extant species are endangered.

What is Ruby?

Ruby is a bright red gem. It is considered one of the four precious gemstones, along with emeralds, diamonds, and sapphires. There is controversy on whether rubies are red sapphires or sapphires are blue rubies.

How are they similar?

To an outsider, ruby and python can look almost identical:

Dynamically Typed: What type of thing the word means dynamically depends on context. Python can either be a type of family (pythonidae), genus (python), or species (P. reticulatus). Similarly, Ruby can be either a specific mineral (corundum with chromium impurities) or the general category of red-colored stones.

What type of thing the word means dynamically depends on context. Python can either be a type of family (pythonidae), genus (python), or species (P. reticulatus). Similarly, Ruby can be either a specific mineral (corundum with chromium impurities) or the general category of red-colored stones. Interpreted: Pythons and rubies are often used as symbols and metaphors, especially in poetry and mythology.

Pythons and rubies are often used as symbols and metaphors, especially in poetry and mythology. Object Oriented: They are both objects. Ruby is considered more object-oriented, though, because some people are uncomfortable thinking of animals as objects.

They are both objects. Ruby is considered more object-oriented, though, because some people are uncomfortable thinking of animals as objects. High Level: I studied physics in college and anything bigger than a hydrogen atom is considered “high level”. I’m not kidding. We don’t even have a closed-form solution for a helium atom yet and it’s just a hydrogen atom with an extra fiddly bit.

How are they different?

While they may seem extremely similar, there are also some key differences between the two:

Ruby has blocks , in that you can put rubies into blocks. If you put pythons into blocks, they’ll slither away.

, in that you can put rubies into blocks. If you put pythons into blocks, they’ll slither away. Python has comprehensions . Rubies are inanimate objects and do not comprehend things.

. Rubies are inanimate objects and do not comprehend things. Python is generally considered more readable (you can sharpie bigger words on a snake), while Ruby is considered more elegant (obvious).

What are some other important examples?

Rails: You can put ruby on rails, and it will stay on the rails, unless it rolls off.

You can put ruby on rails, and it will stay on the rails, unless it rolls off. Pandas: A python could probably eat a panda if it tried really hard.

A python could probably eat a panda if it tried really hard. Chef: You think this would be a python thing, but most chefs avoid reptiles and will sometimes accept rubies as currency.

You think this would be a python thing, but most chefs avoid reptiles and will sometimes accept rubies as currency. Django: A guitarist who presumably liked snakes.

So which is better?

It depends!!!

You promised an objective, definitive answer.

I’m serious. It depends. What are you trying to do?

Play scrabble: Ruby is worth 9 points, python is worth 14 and pluralizes to a bingo. Advantage: Python

Ruby is worth 9 points, python is worth 14 and pluralizes to a bingo. Shot put: Don’t throw snakes. Advantage: Ruby

Don’t throw snakes. Model a solenoid electromagnet when you have a cylinder but forgot your string and wire at home: You’ll have to be pretty strong but otherwise this is a great use case for python. Advantage: Python

You’ll have to be pretty strong but otherwise this is a great use case for python. Wear as jewelry: On one hand, rubies are pretty popular in jewelry. On the other, a sneklace would be hella sweet. Advantage: Tie

On one hand, rubies are pretty popular in jewelry. On the other, a sneklace would be hella sweet. Run a kissing booth: People vastly prefer to kiss rubies than pythons, perhaps due to a reduced risk of getting salmonella. Advantage: Ruby

As you can see, for the majority of uses half of the time you’ll want to use ruby and half the time you’ll want to use Python. There are probably some other minor cases that push the ratio above 1:1 but they’re niche and esoteric at best.

What programming language should I use for my startup?

PHP.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising &sponsorship opportunities.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

Tags