(1) I believe the recent consensus was that the number of comparisons made in a dict lookup is an implementation detail. (Please correct me if I am wrong.) (2) Is "the item will be hashed at least once" a language guarantee? For small mappings, it might well be more efficient to just store the 2-3 key/value pairs and skip the bucket calculation. On the other hand, if a key is not hashable, discovering that long after it has already been added to the dict is suboptimal. Of course, that sort of delayed exception can already happen if it is the __eq__ method that is messed up ... -jJ
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