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

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jun 23 10:39:28 CEST 2013


Joshua Landau wrote:
> What about:
> 
> class Foo:
>     bar = bar

That would be going too far, I think. I can't remember *ever*
needing to write code like that in a class. On the other hand,
passing function arguments received from a caller on to another
function under the same names is very common.

Also, it's a somewhat dubious thing to write anyway, since it
relies on name lookups in a class scope working dynamically.
While they currently do in CPython, I wouldn't like to rely on
that always remaining the case.

I'm not sure about the dictionary case. It's not strictly
necessary, since if you have it for keyword arguments, you
can do dict(=a, =b, =c).

So I'm +1 on allowing this for function arguments, -0 for
dicts, and -1 on anything else.

-- 
Greg


More information about the Python-ideas mailing list