Terry Reedy schrieb: >> The first time a non str object is inserted or looked up, the dict >> swiches to a more general lookup methods. > > This makes adding a string-only dict pretty trivial, if desired. It's not as trivial as it seems. The switch over to the general lookup method happens when a non str object is *looked up*. d = {'a': None} # uses lookdict_string() d.get(1, None) # d now uses lookdict() "d->ma_lookup == lookdict_string" is a sufficient condition, not a condicio sine qua non. > Assuming that 3.x dicts are optimized for the 3.x string type, this is > not a problem for 3.x ;-). Well, it's always optimized for the str type - which happens to be PyUnicodeObject in 3.x. Christian
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