Changes between Initial Version and Version 1 of Ticket #13394, comment 25


Ignore:
Timestamp:
10/29/13 23:15:08 (5 years ago)
Author:
nbruin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13394, comment 25

    initial v1  
    3030
    3131With this extra primitive you could write a safer callback on `WeakValueDictionary` without needing the extra indirection. You'd call `init_dummy` upon instantiation of a !WeakValueDictionary, to ensure that it's initialized.
     32
     33'''EDIT:''' The value of PERTURB_SHIFT is of course critical, but it is a value that was found after extensive tuning. This value is not going to change any time soon. So hardcoding this is not a big issue for maintainability. The extraction of `dummy` is of course clumsy, but fairly robust. Therefore, I think this approach is feasible. It may be worth testing how it works. A lot of the routines on your !WeakValueDictionary will be a lot simpler and avoiding the "double hashing" that happens now (access to the dict means computing the hash of what is already the hash of an actual key).
     34
     35(I've tried your branch, by the way, but it crashes. Reverting your last two commits does give me something that seems to work)