Inada Naoki <songofaca...@gmail.com> added the comment:
> The unpacking is only a problem if you insist on using PyDict_Merge(). It > would be perfectly possible to implement dict merging from a tuple+vector > instead of from a dict. In that case, there shouldn't be a performance > penalty. Really? ``` class K: def __eq__(self, other): return True def __hash__(self): time.sleep(10) return 42 d1 = {"foo": 1, "bar": 2, "baz": 3, K(): 4} d2 = dict(**d1) ``` I think `dict(**d1)` doesn't call K.__hash__() in this example, because hash value is cached in d1. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue29312> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com