News for hackers. Stuff that matters.
Re:Ruby’s magic underscore by msbarnett on Saturday September 22, 2012 @05:13PM (#4559006)
> Why does _ need to be special cased like this? In Python this works with any variable name.

To, in general, make giving multiple arguments for a function or block/lambda the same name a syntax error.

Python special-cases generators, but having multiple identical argument names for a function in Python is a syntax error.

Ruby is a bit more 'regular' in that in both blocks/lambdas and functions, reusing an argument name is always an error. '_' then functions not as a name but a special 'disregard' symbol.

There are no comments on this comment yet.