Setdefault bypasses __setitem__
Duncan Booth
duncan.booth at invalid.invalid
Thu Oct 13 07:24:05 EDT 2005
Diez B. Roggisch wrote:
> So if setdefault
> was implemented as
>
> def setdefault(self, v):
> self["SOME_DEFAULT_KEY_NAME"] = v
if setdefault was implemented that way then all current uses of setdefault
would throw an exception.
setdefault takes *three* parameters: self, key, value. Once you include the
key parameter your entire argument implodes.
More information about the Python-list
mailing list