Answer the question
In order to leave comments, you need to log in
Ruby or Python?
Good afternoon, hackers. I would like to hear your opinion. I want to start learning scripting language. And now faced with a choice. What are the advantages of what? If I apologize, on Habré not so long ago.
Answer the question
In order to leave comments, you need to log in
I write in both languages.
Ruby at one time chose for the appearance of the code (as a former delphist, he is closer to me).
Later, due to the greater distribution on hosting, I began to write in python.
At first, the appearance of the python is shocking: strict indentation, colons after functions, no closing of the loop body. Python has a very peculiar zoo of modules, they are broken into smaller pieces, so as a rule, more modules have to be connected in python.
Ruby seems more structured and ideological. Python is more pragmatic. But over time, you realize that the python has its own charm. For example, after a python, I constantly strive to put a colon, or end's "forget" to put)
Both languages have existed for many years, they have libraries for all occasions. Both languages are well described, there are many examples on the Internet for all occasions. Therefore, when the task arises to do something, the answer is always found.
Set yourself a programming challenge. And do it in ruby and python.
You will feel which language is closer to you.
Depending on the task.
Here is a compilation of opinions:
If you are interested in the web, then I advise ruby, rails are developing very actively. Python has django, but it's also very popular off the web.
A feature of rubists is that they love fresh. And pythonists love proven old solutions.
The ruby syntax is very flexible, and python assumes strictness to reduce the number of potential errors: there will not even be assignments in comparisons.
While you are thinking, I decided to try python - I downloaded the interpreter and documentation, which was nice to start with, it is built in examples (tutorial.pdf file).
Don't limit yourself, try both!
Let me add a little to the previous answer:
If you start studying, then (according to my modest experience) I advise Python.
For there is a significant difference in philosophy. Please read - Python Philosophy , Ruby Philosophy
Difference (although rather conditional) - Python prefers a more uniform syntax for solving similar problems, Ruby allows you to use many syntaxes, at the request of the developer. Hence the recommendation - if you start - Python will be more obvious. In any case, most training courses now use Python (it replaced Pascal in this regard). But if you are an experienced programmer, Ruby is very elegant.
Look at ruby and python syntax .
Shown from simple variables to classes.
Well, you don't have to ask. It is worth reading about the possibilities of languages, and decide what it is for.
Rubi is an object oriented language.
Python supports all paradigms.
if you only need some simple rubi.
If for complex, then python. Python is more complex and more functional.
There is a language (syntactic and semantic model), there is an interpreter (speed, internal structure, individual features, no bugs) and an environment (IDE, modules, integration). Each must be compared separately.
The syntax doesn't really matter.
The semantics are richer and more flexible in ruby, you can do more interesting obscenities on it, while the python is flat as a snake. Ruby is more suitable for eDSL building, python is more suitable for learning to program in general (well, it is simpler, they say).
The interpreter also means a lot, for a long time ruby didn’t have a normal one (it happens, yeah, when the language is invented, but the interpreter hasn’t been made yet), well, it was buggy there, slowed down, such. Now there is MRI 2.0 and already MRI 2.1 preview. Normal. There are alternatives like jruby, rubinus, they differ from MRI in some details, in multithreading, in memory management.
The python with the interpreter has long been ok, the classic one is installed from turnips, it starts up, no problems, there is nothing special to write about.
The ruby environment is built in my opinion more successfully - there is RVM, there is bundler, there are gems.
Python is worse, virtualenv does not reach rvm in terms of elegance, although there are an order of magnitude more existing libraries.
In one word, python is rigor, and ruby is fun. Accordingly, the choice depends on what you personally like more, not in programming, but in life. I like to put everything on the shelves and adhere to the wisdom of my ancestors - python, I like to have fun and test myself - ruby.
thanks for your opinion. Let's see who else has something to say.
After the pearl, I switched to python, at first it was not convenient, now I’m used to it and the indents have become so convenient that I can’t live without them anymore, the code is easy to read.
To choose, you must probably try both and choose the one that is closer and more understandable. And so the taste and color of the felt-tip pens are different.
Without knowing the intricacies of the language and writing something simple, you will not appreciate the beauty and power of the language, because indentation, semicolons and code like that will not tell you anything. It will be just something along the lines of "I can write in any language like in C". In the case of ruby, try for example ruby.eisen.su/article/135 for sure there is something similar for python. And all sorts of little things and syntactic sugar - in two weeks everything will become like a native.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question