[Python-Dev] Proposal: defaultdict
bokr at oz.net
Fri Feb 17 19:37:08 CET 2006
On Fri, 17 Feb 2006 08:09:23 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= <martin at v.loewis.de> wrote:
>Guido van Rossum wrote:
>I would like this to be part of the standard dictionary type,
>rather than being a subtype.
>d.setdefault() (one argument) should install a default value,
>and d.cleardefault() should remove that setting; d.default
>should be read-only. Alternatively, d.default could be assignable
I like the latter, but d.default_factory = callable # or None
>Also, I think has_key/in should return True if there is a default.
That seems iffy. ISTM potential should not define actual status.
More information about the Python-Dev