Ruby (n) vs Python: the most important questions and answers
Python or Ruby is one of the hottest topics in the programming world. Ahead of him are only “emacs or vim” and “pro-skub or anti-skub” in importance and complexity. Today we will study the difference and answer the questions, and also objectively and finally decide what is best.
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 usually attributed to a group of four gems, along with emeralds, diamonds and sapphires. There is a big controversy: rubies - these are red sapphires or sapphires - these are blue rubies.
What is the similarity?
To a person unfamiliar with the subject, a ruby and a python may seem identical:
Dynamic typing: The type to which a word belongs is dynamically determined from the context. A python can belong to a family ( pythons ), a genus ( broghammerus ) or a species ( reticulated python ). Similarly, ruby can be a specific mineral (corundum with chromium impurities), or it can be a 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 to treat animals as objects.
High-level: I studied physics at the university, and I consider everything that has more than a hydrogen atom “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 all just a hydrogen atom with an additional dangling damn thing.
What are the differences?
Despite a bunch of similar features, there are significant differences:
Rubies have blocks , that is rubies can be put in blocks. If you put the pythons into blocks, they will spread.
Pythons have comprehensions. Rubies are inanimate objects and cannot include anything. ( "comprehension" - understanding, therefore, the original is more fun: "rubies are not able to understand anything," - lane comment. )
Python is considered to be more easily readable (on python you can write large words with a felt-tip pen), and Rubin is considered more elegant (naturally).
What are some important examples?
Rails: You can put a ruby on rails, and it will remain on the rails, unless rolled away.
Pandas (Pandas): A python is likely to be able to eat a panda if it tries hard.
Chef (Chef): It may seem that it is a python, but chefs usually avoid reptiles. But sometimes they take rubies as payment.
Seriously. Depends on the situation. What are you trying to do?
Play Scrabble: A Ruby is worth 9 points, a python is worth 14 points, and with multiple options you can reach bingo. Benefit: 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 - a great way to use python. Benefit: Python
Jewelery: On the one hand, rubies are popular jewelery. On the other hand, snakemaking is a big thing. Benefit: Draw
Organization of kits for kisses: People prefer to kiss rubies, rather than pythons. This may be due to an increased risk of salmonella disease. 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 a few smaller cases that break the beautiful 1: 1 ratio, but they are niche and esoteric.