I'm very familiar with Ruby and for my automation tasks I tend to use it almost exclusively. Of these, is there anything that -
1. Ruby can't do
2. Or is more complex / complicated to do in Ruby
I'm very familiar with Ruby and for my automation tasks I tend to use it almost exclusively. Of these, is there anything that -
1. Ruby can't do
2. Or is more complex / complicated to do in Ruby
What Python does have specifically for automation in my eyes is that it is often the default language for most Raspberry Pi-related hardware libraries. So if you want to build home automation on accessible and easy hardware, the Pi is very welcoming to Python just in terms of making things easy, providing libraries.
It is also heavily supported for machine learning and computer vision which is related. Again, this is generally just a matter of library support.
I don't know the Ruby ecosystem well enough to say if it has equivalents to all the Python scraping, fuzzy matching and such libraries out there. But I expect it does. So that bit is probably a wash.
Hope that gives a perspective.
Didn't know about it being the default language for Raspberry Pi libraries.
Thanks. I've been planning to look at both learning some ML and doing some small Raspberry Pi projects. That's good motivation for diving into Python!
Side note: Ruby has more syntax to grok, which makes it harder to read (for me). On the other hand Python does have its own idiosyncrasies and subtle behaviors. However, Ruby also has some features (like multiline inline functions) that one may easily miss in Python, but they haven't been worth switching over for me.
There's a comparison between node and python's async/await syntaxes here https://medium.com/@interfacer/intro-to-async-concurrency-in...
For ruby I found this article which shows the gist of what we are trying to accomplish with async/await (we want to gather a bunch of promises and await all their results and have them run concurrently in an event loop so that when one is waiting for IO to complete, the other one takes over and runs) https://www.codeotaku.com/journal/2018-06/asynchronous-ruby/...
In case of Ruby, I've found these libraries (ruby gems) to be very useful.
1. Sidekiq - https://github.com/mperham/sidekiq
2. RocketJob - https://github.com/rocketjob/rocketjob
What I'm guessing you're saying is that this kind of behavior is available natively in Python, whereas in Ruby, it is achieved by some roundabout fashion.
async/await works at a function level in the same process. Asyncio in python is pretty much the async/await from node/js.
Sidekiq alternative in python would be closer to http://www.celeryproject.org/
Is it?
I'd imagine JavaScript usage/execution is probably way way higher.
For the second, the definition of 'scripting language' used to be 'doesn't use a compiler' but JS and everything else has a JIT now, so 'make something quick' is a modern equivalent.
let result = await CallbackPromise.from(some.callbackConventionFunction, param);
Then you get a unified form for the code-base.It’s weird lots of Ruby developers feel the need to shout “don’t forget ruby!” when nice things about Python are posted. Just take your pick, who cares.
Btw, I know, assume good faith, yada yada.
Some people obviously swear by it, and thus created Ruby on Rails.
Python does have some weird features as well, but I try to steer away from it, and keep my code simple and boring. My primary concern is how efficient the code is executed as it gets translated into machine code.
The cost/benefit ratio of switching to Ruby never quite seemed worth it. So I continue to stick with Python, for applications that are not time execution sensitive. For all others, there's Java, then C++, then C itself.
some of the best things we have are created by total amateurs. thats how this works.
i’m not 100% on the life histories of Matz and Guido but wasnt Guido kind of also an amateur too?
That is assuming you know how to work with data structures and algorithms the right way. A O(n^n) implementation runs slow in C as well.