[SciPy-user] hash function on arrays
Tue Oct 9 17:33:39 CDT 2007
Tom Johnson wrote:
> On 10/9/07, Robert Kern <firstname.lastname@example.org> wrote:
>> ('numpy.ndarray', a.shape, a.dtype, a.strides, str(a.flags), buffer(a))
> Will this work for arrays defined in different python processes?
> I will be storing these hash values (along with the matrices) in a
> database and doing comparisons at some later time, in some other
> python process.
It depends on how you serialize the arrays and whether or not you care about
things like contiguity. Some ways of serializing might store contiguous versions
of discontiguous inputs. You may want to consider making sure that the arrays
are contiguous and of a fixed byteorder before taking the hash or storing the array.
But nothing should be relying on the memory address of the data or any Python
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the SciPy-user