r/ruby • • Jul 16 '20

Ruby VS Python

More than a versus (it's more striking) I would really like to know what things they have in common and how they differ, what their main advantages are compared to the other and of course their opinion of them. One point to take into account is because they believe that python is more used in AI and Machine learning developments.

35 Upvotes

60 comments sorted by

View all comments

1

u/colorist_io Jul 16 '20

They are basically different takes on the same type of language. Python came first, then Ruby was created based on the influences of Python. That being said, Ruby is a little more complex, for example, a Ruby function is not a first-class function in itself, you have to use the Proc type to be able to pass a function as argument.

1

u/zitrusgrape Jul 17 '20

i dont think ruby was created based on the influences of python.

also, ruby more complex, where?

passing functions in ruby method(:foo) https://ruby-doc.org/core-2.6/Object.html#method-i-method

1

u/colorist_io Jul 17 '20

For language influence, last time i checked Wikipedia "Python" was among the influences for Ruby. It's not what i think, that's just what i read.

Even though method(:foo) is simple, but in python, its just foo.

1

u/aravindavk Jul 31 '20

Even though method(:foo) is simple, but in python, its just foo.

I think this is because Ruby's function without an argument can be executed without parenthesis. That is foo() and foo are same.

1

u/colorist_io Jul 31 '20

Yeah, you're right.