Ruby parens-free function calls [was Re: Accessing parent objects]

Python python at bladeshadow.org
Mon Mar 26 15:48:50 EDT 2018


On Mon, Mar 26, 2018 at 10:43:32AM +0000, Steven D'Aprano wrote:
> The kicker is that out of these four legal, parenthesis-free ways of 
> calling function a, *three* of them interpret the expression as:
>> call a with no arguments
> then add b using the binary plus operator
>> but the last, differing only in whitespace, interprets it as:
>> call a with a single argument, unary-plus b

Thanks for the explanation. That's fucking stupid. I usually prefer
to refrain from cursing in posts but in this case I think that level
of emphasis is required. And FWIW, this convinces me that Ruby is not
a language I ever want to use.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /