This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients
Date 2006-02-21.01:53:23
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=6380

Here's a completely new version after another round of
python-dev.

- The built-in dict type still defines and calls
on_missing(), but the default on_missing() implementation
just raises KeyError(key).  It no longer has a
default_factory attribute.

- You can subclass dict and override on_missing() to do
whatever you want.

- A useful subclass is collections.defaultdict; it defines
an attribute default_factory and its on_missing()
implementation calls that and inserts the resulting value in
the dict (previous versions of the patch had this semantics
in the built-in dict class, which was frowned upon).

- Now with unit tests.

- No docs yet, though.

Assigning to Raymond Hettinger for review.  Raymond, please
assign it back to me for checkin if you're okay with this
(or for revision if you're not :-).  Because of Google's
lawyers I must check this in myself.
History
Date User Action Args
2007-08-23 15:45:48adminlinkissue1433928 messages
2007-08-23 15:45:48admincreate