Author inada.naoki
Recipients inada.naoki, jdemeyer, larry, python-dev, rhettinger, vstinner
Date 2019-07-04.11:55:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562241314.1.0.196779745378.issue29312@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2019-07-04 11:55:14inada.naokisetrecipients: + inada.naoki, rhettinger, vstinner, larry, python-dev, jdemeyer
2019-07-04 11:55:14inada.naokisetmessageid: <1562241314.1.0.196779745378.issue29312@roundup.psfhosted.org>
2019-07-04 11:55:14inada.naokilinkissue29312 messages
2019-07-04 11:55:13inada.naokicreate