Just van Rossum wrote: [snip] > > The __temporary_immutable__ part of the protocol is needed to avoid > unneccesary copying in those cases where the key isn't actually inserted > into the dict, but is only used for membership testing. It would return > a wrapper around the mutable object, defining __eq__ and __hash__. (This > idea is stolen from the sets.py module.) If an implementer doesn't care > about this efficiency, __temporary_immutable__ can be an alias to > __immutable_copy__. Can __temporary_immutable__ work on a multi-threaded system? What is to prevent the (known to be mutable) key from changing underneath you during the lookup? Perhaps I am misunderstanding, but it seems to me that you must either copy the mutable key or be able to block all writers to the key during the lookup. Other than that, I very much like the idea of using mutable keys :) -Eric
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4