In Ruby, parens are optional for all methods, and only required if you need to force non-default precedence.
Returning the value of the last expression seems reasonable to me (just like a UNIX shell).
In Python, I'm bothered by the little inconsistencies. Why is str.len (or length, or size, or count, etc) not a method? Why len(str) instead?
And Python has plenty of oddball syntax: significant whitespace, triple quotes?? You get used to it of course.
Ruby and Python are about equally efficient -- if you're optimizing for code efficiency, both are bad choices. In many domains, that's not a critical metric, so we talk about developer efficiency. I'll argue that developers are more efficient when they are more happy, and for me that selects Ruby by a mile over Python.
But I won't pretend that it's more than a matter of taste. :)
Yes. Especially this. The whitespace thing in and of itself has kept me from ever developing a fondness for Python. Clearly there are plenty of people who aren't bothered by it. De gustibus.
They are both dynamic, OO scripting languages, whose main implementation has a GIL, but beyond that, they aren’t all that similar.
> However, it’s kind of like Python’s weird brother,
Methods-with-self-in-args-list isn’t the “weird” one?
> with optional parentheses for calls without arguments
Parens are optional in Ruby on method calls and method definitions except where necessary to resolve ambiguity (including in the newer special single-line method definition syntax, its not a special syntax option for no-arg methods
> auto-returning the result of the last expression
Ruby is basically an expression-oriented language [0], everything returns a value, and a sequence of expressions returns the last expression in the sequence. Explicit “return” lets you short-circuit that. Python is a statement-oriented language, and statements don’t return things except an explicit return tells the function its in to return something. Both are common kinds of languages, just very different. Neither is “weird”.
I agree that it's uncommon, but I do like the clarity it adds compared to something like "this" which magically refers to the current instance. Hasn't C++ just added something like it with "deducing this"?