Message49511
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. |
|
Date |
User |
Action |
Args |
2007-08-23 15:45:48 | admin | link | issue1433928 messages |
2007-08-23 15:45:48 | admin | create | |
|