Author serhiy.storchaka
Recipients barry, eli.bendersky, eric.smith, ethan.furman, mrabarnett, pitrou, r.david.murray, rhettinger, serhiy.storchaka, theller, tim.peters, vstinner
Date 2013-09-09.22:22:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> I'm curious to know how you'll integrate it in dictobject.c without slowing down normal dict objects, and without making them bigger.

It of course will make a size of source file bigger, but shouldn't affect a size or performance of normal dicts. A dict object contains dk_lookup. Constructor for keyed dict (subclass of ) should initialize it with specialized function which calls the "key" function and recalculate a hash (yes, with this simple approach a hash will be calculated twice, for original and for transformed keys). Hmm, actually it can be even simpler than for IdentityDict (for which not calculating a hash was important). Also some other methods which relies on dict implementation details (e.g. making a copy of dict) should be modified.

The most cumbersome part is the tests. Unfortunately I lost my tests for IdentityDict (used hg diff without --git). It will be good if your provide complete test suite.
Date User Action Args
2013-09-09 22:22:29serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, barry, theller, rhettinger, pitrou, vstinner, eric.smith, mrabarnett, r.david.murray, eli.bendersky, ethan.furman
2013-09-09 22:22:29serhiy.storchakasetmessageid: <>
2013-09-09 22:22:29serhiy.storchakalinkissue18986 messages
2013-09-09 22:22:29serhiy.storchakacreate