
Oct. 16, 2018
9:26 a.m.
On Tue, Oct 16, 2018 at 7:02 PM George Leslie-Waksman <waksman@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 hashable.
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:
hash((1,2,3)) 2528502973977326415 hash((1,2,[])) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'list'
ChrisA