Maybe I’m wrong but things like 3.times { ... } are more prevalent in ruby than in other languages. There’s optional return statement (do I put it or not?), strings vs symbols, hash conventions ({ hello: :world } vs { “hello” => “world” }, people still use both), optional parenthesis in method calls, etc. I think ruby gives more ways to do the same thing, but that’s confusing for a newcomer. That being said, it’s my favorite language.
That's true, but I think for a beginner having more ways to do things is also nice, since you have the freedom of doing any one thing in multiple ways. Once you're more comfortable with the language, you don't even really think about it, you just pick what you prefer and what makes sense in the given context.
I'll address the points you made since I love talking about Ruby lol, hope you don't mind!
I'm not sure what you mean with the 3.times {} point. I personally prefer the 3.times do ... end syntax, because it's basically English, it makes it very easy to comprehend what's happening as a beginner. You're doing a thing 3 times, it might as well be pseudocode. IMO it's much more elegant than the whole for (i = 0; i < 3; i++) syntax that's more common in other languages.
The optional return thing I'd agree with, it can lead to some confusing situations. Even after years of Rubying, I sometimes get caught by an unexpected return, especially if I'm working in other langs for a bit. Though if you just disable Rubocop's warnings, you can put a return in no problems! I even encourage beginners to explicitly put in returns, so that the methods they write do what they intend them to do. Didn't intend to return that specific thing there? Now it's clear!
What specifically about strings and symbols? The only caveat that I can think of is that symbols are immutable whereas strings are not , but I don't know how often beginners come across situations where they're confronted with symbols outside of a Hash anyway.
The hash conventions are simply a matter of legacy code. I forget when the rocket (=>) syntax was 'replaced', for lack of a better word, but that's just because before a certain version of ruby you couldn't do the foo: :bar syntax. For legacy purposes, the rocket one remains, but in my experience most people writing modern ruby stick with the foo: :bar convention.
I'd also agree with the optional parenthesis bit, though again for beginners I just tell them to always put parens since it makes it easier to reason about methods.
There’s a chance component to why Python is so popular in data analysis. But I’ve seen many non-programmers get into computational science. Like biologists doing bioinformatics. And my gut feel is it’be harder to get them into Ruby compared to Python. I have experience explaining tidyverse vs vanilla in R. Tidyverse libraries have a lot of synthetic sugar as well. But it’s challenging to get newcomers to appreciate it, because you have to always go an extra mile to explain what it means. Whereas vanilla(and Python) is closer to what they studied in CS101. So the whole machine learning for ruby is going to be very niche.
Can't tell you the amount of times I've been able to just put pseudocode down in Ruby and have it work somehow, the language is beautiful