Movatterモバイル変換
[0]ホーム
[Python-Dev] setdefault's second argument
Barry Warsawbarry 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>> d.get(x)>> returns None if x doesn't exist, it makes some kind of sense that>> d.setdefault(x)I think that's right, and IIRC the specific detail about the optionalsecond argument was probably hashed out in private Pythonlabs email, orover a tasty lunch of kung pao chicken. I don't have access to myprivate archives at the moment, though the public record seems to startabout here:http://mail.python.org/pipermail/python-dev/2000-August/007819.html> 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) ?Heh.http://mail.python.org/pipermail/python-dev/2000-August/008059.html> (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 itssecond argument -- I've never used it without one. But don't remove themethod, it's quite handy.-Barry-------------- next part --------------A non-text attachment was scrubbed...Name: not availableType: application/pgp-signatureSize: 307 bytesDesc: This is a digitally signed message partUrl :http://mail.python.org/pipermail/python-dev/attachments/20050830/e7a714ee/attachment.pgp
More information about the Python-Devmailing list
[8]ページ先頭