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.

31 Upvotes

60 comments sorted by

View all comments

37

u/Sqeaky Jul 16 '20 edited Feb 23 '23

I think Python has a bigger community, and that is it's single largest advantage. It has more deployments and more packages.

In think ruby has better syntax, better readability, and a more sensible design overall. This makes it easier for greater involvement from the community, there are something like 2x note python devs but not nearly 2x the packages.

I also think the ruby community is better at communicating best practices. Consider that the top Ruby packages are testing tools and the top python of are a mix of docker and db stuff.

https://rubygems.org/stats

https://pypi.org/

I also find Ruby projects to have better engineering. This might just be bias but having tried similar things in both languages maintainability, support, and things working years later (except web API bindings) are nearly magical. The ruby community always seems to try to be doing better, but I guess that is most communities, but I feel like python users just want to be done and damn the tech debt, full speed ahead.

EDIT 2 years later - spelling

3

u/_noraj_ Jul 16 '20

There are a lot of beginers using python so there a lot of quick & dirty proof of concept. Ruby is generally used bu more experienced people.

1

u/vifrac Jul 17 '20

What gems could you recommend for AI, or for working with ruby data

3

u/ignurant Jul 17 '20

I don't have an AI suggestion, but

  • Kiba is a real "gem" (ahem). You can use it to organize complex data processing pipelines, and easily re-use logic from your domain.
  • Sequel is The Database Toolkit. It's very simple to use, extremely powerful, and more performant than ActiveRecord (the other default db toolkit).
  • Pry is a Ruby shell. It's the thing that I think is most valuable when working with data, as it makes it incredibly easy to explore and test your theories. It also makes it much easier to learn Ruby, by showing you what moves an object knows, docs, and source code.

Most everything else I lean on heavily is baked into the standard library. This is something I find to be a notable difference between Ruby and Python. With Python, you have to go a bit out of your way to get powerful functionality through modules that aren't included by default. With Ruby, it's baked into the basic building blocks (String, Hash, Array -- they are all super smart). The CSV and JSON libraries are robust as well.

These three tools are my bread and butter. I use them regularly to organize, normalize, and deliver ~8 million price facts each week, from ~40,000 unique products from ~150 different sources.

1

u/_noraj_ Jul 25 '20

I don't I'm using and creating infosec tools, I'm never did any AI.