[Python-Dev] setdefault's second argument
barry at python.org
Tue Aug 30 22:18:38 CEST 2005
On Tue, 2005-08-30 at 14:53, Fredrik Lundh wrote:
> Some kind of symmetry with get, probably. if
> returns None if x doesn't exist, it makes some kind of sense that
I think that's right, and IIRC the specific detail about the optional
second argument was probably hashed out in private Pythonlabs email, or
over a tasty lunch of kung pao chicken. I don't have access to my
private archives at the moment, though the public record seems to start
> Anyone remember why nobody managed to come up with a better name
> for setdefault (which is probably the worst name ever given to a method
> in the standard Python distribution) ?
> (if I were in charge, I'd rename it to something more informative.
Maybe like getorset() <wink>.
Oh, and yeah, I don't care if we change .setdefault() to require its
second argument -- I've never used it without one. But don't remove the
method, it's quite handy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20050830/e7a714ee/attachment.pgp
More information about the Python-Dev