Ruby (n) vs Python: the most important questions and answers

Original author: Hillel Wayne
  • Transfer

Python or Ruby is one of the most discussed topics in the programming world. Ahead of him is only “emacs or vim” and “pro-skub or anti-skub” in importance and complexity. Today we will study the difference and answer questions, as well as objectively and definitively decide which is better.

What is python?

Python is a large snake that lives in the southeastern regions of the planet. They are not poisonous and neutralize enemies mainly by strangulation. Many of the surviving species are endangered.

What is Ruby (n)?

Ruby (ruby) is a bright, red gem. It is customary to refer to the group of four precious stones, along with emeralds, diamonds and sapphires. There is much debate: rubies are red sapphires or sapphires are blue rubies.

What are the similarities?

For a person unfamiliar with the topic, ruby ​​and python may seem identical:

  • Dynamic typing: The  type to which the word refers is dynamically determined from the context. A python can refer to a family ( pythons ), a genus ( broghammerus ), or a species ( reticulated python ). Similarly, ruby ​​can be a specific mineral (corundum with chromium impurities), or belong to the general category of red stones.
  • Interpreted: Pythons and rubies are often used as symbols and metaphors, especially in poetry and mythology.
  • Object Oriented: They are both objects, but some people are uncomfortable with animals as objects.
  • High-level: I studied physics at the university, and I consider everything that is larger than a hydrogen atom to be "high-level." I am not kidding. We have not yet found a solution to the Schrödinger equation for a helium atom, and this is just a hydrogen atom with additional dangling horseradish.

What are the differences?

Despite a bunch of similarities, there are significant differences:

  • Rubies have  blocks , that is, rubies can be stacked in blocks. If you put the pythons into blocks, then they will creep.
  • Pythons have list comprehensions. Rubies are inanimate objects, and are not able to include anything. ( "comprehension" is understanding, therefore in the original it turns out funnier: "rubies are not able to understand anything," - approx. trans. )
  • Python is considered to be easier to read (you can write big words with a felt-tip pen on python), and Rubin is considered more elegant (of course).

What are some important examples?

  • Rails: A ruby can be put on the rails and it will remain on the rails unless it rolls away.
  • Pandas: A  python is likely to be able to eat a panda if it works hard.
  • Chef: It might seem like a python, but chefs usually shun reptiles. But sometimes they accept rubies as a payment.
  • Django: The  guitarist who loved snakes.

What's better?

Depends on the situation!!!

You promised an objective, final answer!

Seriously. Depends on the situation. What are you trying to do?

  • Play scrubble:  Ruby costs 9 points, python costs 14 points, and with plural options, you can reach bingo. Advantage: Python
  • Shot put:  Do not throw snakes. Benefit: Ruby
  • Modeling a solenoid electromagnet when there is a cylinder, but forgot the rope and wire at home:  You need to be strong enough, but otherwise it's a great way to use python. Advantage: Python
  • Jewelry:  On the one hand, rubies are popular jewelry. On the other hand, sunbathing is awesome. Advantage: Draw
  • Organization of a kiss booth: People prefer kissing rubies rather than pythons. Perhaps this is associated with an increased risk of salmonellosis. Benefit: Ruby

You can see that in about half of the cases, you can make a choice in favor of ruby, and in the other half of cases - in favor of python. Most likely, there are several more minor cases that break the beautiful 1: 1 ratio, but they are niche and esoteric.

What programming language to use in your startup?


Also popular now: