[Python-Dev] Half-baked proposal: * (and **?) in assignments (original) (raw)

Brett Cannon bac@OCF.Berkeley.EDU
Sat, 23 Nov 2002 00:17:01 -0800 (PST)


[Gareth McCaughan]

Since

def f(a,b,*c): ... f(1,2,3,4,5) does (in effect) a=1, b=2, c=(3,4,5), I suggest that a,b,*c = 1,2,3,4,5 should do a=1, b=2, c=(3,4,5) too. Likewise, a,b,c,d,e = 1,2,*(3,4,5) should be parallel to def f(a,b,c,d,e): ... f(1,2,*(3,4,5))

This just strikes me as YAGNI. I have never felt the need to have this kind of assignment outside of parameter passing. If this kind of assignment is that big of a deal you can just use slicing. I realize the same argument can be used for parameter arguments, but the reason for having *args and **kwargs is to allow more general functions and I just don't feel this is needed for assignment.

This might all seem rather weak and vague, but my gut is just saying this is not a good idea.

So -1 from me unless this feeling is from indigestion.

-Brett