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 rhettinger
Recipients
Date 2006-02-22.02:00:14
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=80475

Maybe after sleeping on the idea, you'll like it better.  
Otherwise, we're adding on_missing() to the dict API where 
it cannot possibly be called, only a subclass can do that.

The essence of the patch is meeting the known regular 
default_factory use cases (with list, int, or set).  No 
one has yet proposed use cases for overriding on_missing() 
with other functionality.

So if you code it all in default_dict, you make the patch 
cleaner, leave the dict API unmolested, make it easier to 
understand the call sequence (no parent to child to parent 
steps), and still leave open the possibility that someone 
could override default_dict.on_missing() if they discover 
a need for defaults computed from a key.

Also, I suspect that from a beginner point-of-view that 
having on_missing() defined in dicts will create confusion 
(don't call this method, just override it in a subclass, 
it is only triggered by getitem, there is no relation to 
get() or to setdefault(), ...)
History
Date User Action Args
2007-08-23 15:45:50adminlinkissue1433928 messages
2007-08-23 15:45:50admincreate