Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Python by (4.1k points)
What are the advantages of Ruby over Python?

1 Answer

0 votes
by (14.4k points)

Everything returns a value. Because of this, it is easier to write functional-like code than in python and much easier to chain commands.

Consistent object orientation. Python suffers from design decisions made early on that makes it hard to use object orientation.  

Open classes. It is really easy to open a class and just add a method to it. Yes, you must be careful with it, but it is the right way to solve lots of problems.

Anonymous blocks. Python has anonymous closures, but they must fit on a single line. In ruby, every method implicitly supports passing in an anonymous block. Anonymous blocks allow you to write code that allows users of a method to make modifications to the code using variables in their current scope. They are extremely powerful and easier to use in ruby.  

Related questions

0 votes
1 answer
asked Sep 23, 2019 in Python by Karan Singh (4.1k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...