[Numpy-discussion] Implementing hashing protocol for dtypes
Thu Mar 12 08:15:43 CDT 2009
Stéfan van der Walt wrote:
> 2009/3/12 David Cournapeau <firstname.lastname@example.org>:
>> Anyway, here is a first shot at it:
> Design question: should [('x', float), ('y', float)] and [('t',
> float), ('s', float)] hash to the same value or not?
The only constraint is that a == b -> hash(a) == hash(b) (which is
broken currently in numpy, even for builtin dtypes). The main problem is
that I am not very clear yet on what a == b is for dtypes (the code for
PyArray_EquivTypes goes through PyObject_Compare for compound types). In
your example, both dtypes are not equal (and they do not hash the same).
More information about the Numpy-discussion