[Tim]
> Anyone remember why setdefault's second argument is optional?

IIRC, this is a vestige from its ancestor.  The proposal for
setdefault() described it as behaving like dict.get() but inserting the
key if not found.



> Haven't found
> any 1-arg uses of setdefault() either, except for test code verifying
> that you _can_ omit the second arg.

Likewise, I found zero occurrences in the library, in my cumulative code
base, and in the third-party packages on my system.



> If there isn't a sane use case for leaving the second argument out,
> I'd like to drop the possibility in P3K (assuming setdefault()
> survives).

Give a lack of legitimate use cases, do we have to wait to Py3.0?  It
could likely be fixed directly and not impact any code that people care
about.



Raymond

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to