Peter Funk writes: > Ouppss... I should have tested this before posting. But currently I use > the more explicit (and probably slower version) in my code: The performance is based entirely on the size of each; in the (probably typical) case of smallish dictionaries (<50 entries), it's probably cheaper to use a temporary dict and do the update. For large dicts (on the defaults side), it may make more sense to reduce the number of objects that need to be created: target = ... has_key = target.has_key for key in defaults.keys(): if not has_key(key): target[key] = defaults[key] This saves the construction of len(defaults) 2-tuples. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> Corporation for National Research Initiatives
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