Paul.Moore at atosorigin.com
Tue Jan 20 09:41:19 EST 2004
From: Raymond Hettinger
> [Bob Ippolito]
>> d.setdefault(k, factory=list).append(v) ?
> That is somewhat nice and backwards compatible too.
How is it more expressive than d.setdefault(k, ).append(v)? As
far as I can see, it's longer and contains an extra obscure(ish)
And I agree with the other posters that other defaults are often
useful, and further complicating the dictionary interface isn't
If conciseness is important,
def addlist(d, k, v):
More information about the Python-Dev