23 Jun
2013
23 Jun
'13
11:34 p.m.
Steven D'Aprano wrote:
The special case "parameter name matches exactly argument expression" is far too special, and the benefit far too minor, to deserve special syntax.
It occurs more often than you might think, because taking parameters that you've been passed and passing them on to another function is a common pattern.
Oh, one last thing... your suggestion is also brittle. If you refactor the variable name, or change the function parameter name, code using this shortcut will break. Parameter names are part of the function API and shouldn't change, but variable names are not
But it's not just any variable, it's a parameter to your function, so it's not likely to change its name either. -- Greg