[issue15814] memoryview: equality-hash invariant
Martin v. Löwis
report at bugs.python.org
Mon Sep 3 21:59:03 CEST 2012
Martin v. Löwis added the comment:
Am 02.09.2012 16:21, schrieb Alexander Belopolsky:
> I have refrained from voting because in my line of work buffers or
> memoryviews deal with large objects that rarely serve as dictionary
> keys. As a result, I have zero experince with hashing of buffers.
> This observation supports the current consensus to limit hashing to
> 1d and 0d cases. My only concern is that with hash(m) ==
> hash(m.tobytes()) implementing multidimensional restriction will
> require artificial if ndim > 1 check and an extra sentence in the
> docs while not simplifying anything.
As for the "not simplifying argument": if hashing was restricted
to contiguous bytes, then the implementation would certainly be
simplified quite a bit: currently, if it's not contiguous, it needs
to make a separate copy and hash that. This code could go away
if hashing would only work for true memory "blocks".
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15814>
_______________________________________
More information about the Python-bugs-list
mailing list