Message347277
> 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. |
|
Date |
User |
Action |
Args |
2019-07-04 11:55:14 | methane | set | recipients:
+ methane, rhettinger, vstinner, larry, python-dev, jdemeyer |
2019-07-04 11:55:14 | methane | set | messageid: <1562241314.1.0.196779745378.issue29312@roundup.psfhosted.org> |
2019-07-04 11:55:14 | methane | link | issue29312 messages |
2019-07-04 11:55:13 | methane | create | |
|