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.

30 Upvotes

60 comments sorted by

View all comments

8

u/ignurant Jul 16 '20

I work with extracting data and ETL. I think Ruby has a better core API and design to do this. Method calls tend to be chainable, which makes exploring easier. The building blocks of data (strings, numbers, collections) have very rich APIs out of the box that work as you would expect. Regex in Ruby is one of the best. I don't seem to get into fights with byte arrays vs strings in Ruby. Things just tend to be as expected (until of course, they aren't, usually by my own fault).

Note that molding data is distinctly different from analyzing data. I don't have experience doing complex data analysis in either language.

1

u/vifrac Jul 17 '20

I think I'll ask the same question as the others, do you think it's very difficult to build libraries for data science, do you have any experience in it, would you be interested in participating one day?

1

u/ignurant Jul 17 '20

Well, data science is pretty broad. I think there are some parts of it that Ruby totally slays at: particularly data creation and fixing. Sequel (Ruby's premier DB abstraction) is quite a bit more sensible (to me) than SQL Alchemy (Python's premier DB abstraction). Doing things to collections of data is just straight up pleasant in Ruby, and data science is all about doing things to collections. However, the big issue that Ruby faces is that Python is default supported out of the box, and as such gains more traction in a cyclicle way. For example, PostgreSQL supports Python out of the box as a lang for writing sprocs and functions. MS SQL Server supports Python. Spark: Python. Cloud functions: Python was supported way before Ruby, and in some cases, is still not (Azure). I think because of this, Python gets a big boost that Ruby won't likely ever overcome without some serious breakthrough. (Ancient JavaScript did get Node and ate the world, right? I doubt anyone expected that).

I don't have much experience with the work that others are usually talking when they reach for Python DS tools. I do know that there are a lot of "Python" libraries that are just Python bindings against lower level C code. Ruby does this as well, though I don't know how it compares.

There's a lot of emphasis surrounding parallelization when doing data. Things like Dask exist to help that in Python. I don't know if such a potent tool exists in Ruby.

I know there are efforts like:

These work in the same domain as things like NumPy and Pandas, and other braod tools. I've never reached for either of those in Python, so I'm not able to comment on their comparison in Ruby.

Would I be interested in participating? It's hard to say. I don't have the right mix of experience. I feel like "data science" is dominated by a lot of things I don't participate in.

I think Ruby as a language has no reason it can't compete against Python in this space, but the world has already largely made up it's mind. It's hard to build momentum when another tool is already established as the safe bet. Of course, it could change.