[issue15814] memoryview: equality-hash invariant
Stefan Krah
report at bugs.python.org
Wed Aug 29 22:04:10 CEST 2012
Stefan Krah added the comment:
Martin v. L??wis <report at bugs.python.org> wrote:
> In general, since memoryview(obj)==obj, it would be necessary that
> hash(memoryview(obj))==hash(obj). However, since memoryview cannot
> know what hashing algorithm obj uses, it cannot compute the hash
> value with the same algorithm.
In the memoryview-hash thread on python-dev [1] this objection was
addressed by demanding from exporters that they all use:
hash(x) == hash(x.tobytes())
Since the previous equality concept was also based on
x.tobytes() == y.tobytes(), this wasn't a problem.
The new equality definition and any possible new hash definition should
probably also be part of the buffer API documentation, since they
aren't memoryview specific.
[1] http://mail.python.org/pipermail/python-dev/2011-November/114459.html
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15814>
_______________________________________
More information about the Python-bugs-list
mailing list