You need to lighten up a bit. He gives points on both sides. I do only Ruby and I get what he means.
You need to lighten up a bit. He gives points on both sides. I do only Ruby and I get what he means.
I've looked at quite a bit of Python and Ruby source code and Python uses square brackets, periods, mathematical symbols, parentheses, and colons in similar ways. Indeed, a method definition in Ruby uses fewer symbols (no need for the colon on the end, or even the parentheses, although that's against common Ruby style). Python even makes nonsense like using double underscores in method names obligatory. Or how about Python's obligatory parentheses on all method calls?
How is Ruby really more "line noise" than Python? Seriously. Sure, Ruby allows you to be more lax than Python and write poor, "line noisy" code, but good Ruby is no more "line noise" than good Python.
also when i use regexps in ruby i then say "/re(g)ex/ =~ 'string' && $1". in python that would be multiple statements: "m = re.match('re(g)ex', 'string'); m.group(1)"
in python existing syntax (or more familiar syntax) is used to accomplish all the above.
Also, your Ruby vs. Python regex examples aren't even equivalent.
But on inheritance - you have to put the class name in round brackets in Python, no? That's 2 characters to Ruby's 1.
Stuff like a ||= shouldn't be considered Ruby-specific noise as Python also has the same idiom as in a += and a -=, just not with ||. || is arguably noise over "or" but it shouldn't seem like cryptic noise with any sort of experience of C, C++, Java, JavaScript, or almost any other mainstream language.
Further, that Ruby code of yours does seem more Perlish than Rubyish, but I suspect this is because Ruby style is gradually shifting away from Perl-like styles to more idiomatic approaches. For example, I'd probably choose 'string'[/re(g)ex/, 1] or if I was trying to be "proper" then something like m = string.match(/re(g)ex/); m[1] (or potentially use Regexp#match, but I far prefer String#match). I see those solutions more typically than those you present - and the latter is quite like your Python example - but.. TMTOWTDI and that's Ruby's greatest asset :)