A RetroSearch Logo

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

Search Query:

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

[Python-Dev] setdefault's second argument

[Python-Dev] setdefault's second argument [Python-Dev] setdefault's second argumentFredrik Lundh fredrik at pythonware.com
Tue Aug 30 20:53:23 CEST 2005
Tim Peters wrote:
> Anyone remember why setdefault's second argument is optional?

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)

returns None as well.

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.  I'd also
add a "join" built-in (similar to the good old string.join) and a "textfile" 
built-
in (similar to open("U") plus support for encodings).  but that's me.  I 
want
my code nice and tidy.)

</F> 



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