[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But there is an issue with comparison implementation in MappingProxyType (see issue43838). Resolving that issue can affect the decision about hashability. There should be always true the following predicate: if x == y then hash(x) == hash(y). --

[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Perhaps MappingProxyType is unhashable by accident. It implements __eq__, and it makes it unhashable by default. And nobody made request for this feature before. I think that implementing __hash__ would not make anything wrong. --

[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Serhiy, what do you think? Would it make sense to pass through the underlying hash? I don't think there is much use for this but don't see any particular reason to block it. -- nosy: +rhettinger, serhiy.storchaka priority: normal -> low

[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-13 Thread Andy Maier
New submission from Andy Maier : Objects of MappingProxyType do expose a __hash__() method, but if the underlying mapping is hashable, it still does not support hashing it. Example: Content of mp_hash.py: -- #!/usr/bin/env python from nocasedict import NocaseDict, HashableMixin from