[Python-ideas] Short form for keyword arguments and dicts

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jun 24 01:34:49 CEST 2013


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


More information about the Python-ideas mailing list