[Python-ideas] Revisiting Immutable Mappings
rosuav at gmail.com
Tue Oct 16 05:26:52 EDT 2018
On Tue, Oct 16, 2018 at 7:02 PM George Leslie-Waksman <waksman at gmail.com> wrote:
> Would a frozendict require that keys and values be hashable?
Keys would already have to be hashable - regular dicts demand this,
and there's no reason not to for frozendict.
Values? Not so sure. Personally I would say that no, they don't HAVE
to be hashable - but that the frozendict itself would then not be
> It seems to me that we would need this restriction to make a reasonably universal frozendict that is, itself, hashable.
The tuple provides a good precedent here:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
More information about the Python-ideas