A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-August/055833.html below:

[Python-Dev] setdefault's second argument

[Python-Dev] setdefault's second argument [Python-Dev] setdefault's second argumentRaymond Hettinger raymond.hettinger at verizon.net
Tue Aug 30 18:35:05 CEST 2005
[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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4