[Python-3000] A request to keep dict.setdefault() in 3.0

Barry Warsaw barry at python.org
Tue Jul 10 00:17:08 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jul 9, 2007, at 5:29 PM, Raymond Hettinger wrote:

>> PEP 3100 suggests dict.setdefault() may be removed in Python 3, since
>> it is in principle no longer necessary (due to the new defaultdict  
>> type).
>
> I've forgotten.  What was the whole point of Python 3.0?
> Is it to make the language fat with lots of ways to do everything?
> Guys, this is your ONE chance to slim down the language and
> pare away anything that is unnecessary or arcane.
>
> The setdefault() method has too many defects to keep around.
> Why would you want a method that instantiates the default on
> every call even if not needed.

Um, like .get()?

> Let this one die.  The dict API already heavily loaded.  Thinning
> it a bit would be a nice improvement.

Unless you remove something useful.  The problem with setdefault()  
isn't what it does, it's the name.

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQCVAwUBRpKz5HEjvBPtnXfVAQKV4gP+Ntpkcmo9Yx0d0CvPuGen1E78RLGVquhm
wtaGY2OHsQk8Fq+5DSLdTLQcqba5Ru8kToxcFG+FbKuul7xvN+yFJ4yfFzBKvp6z
CLwE+GkP6v/zC/W1hJ0zkd/0zWE4tPp5Egmug5BhZ6n2ZkwX2ExCfq2jMXf/xmsV
cmu7z3TWQXI=
=BzxB
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list