This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dag.Sverre.Seljebotn
Recipients Arfrever, Dag.Sverre.Seljebotn, belopolsky, christian.heimes, georg.brandl, loewis, mark.dickinson, meador.inge, ncoghlan, pitrou, scoder, skrah, vstinner
Date 2012-08-31.03:31:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346383891.67.0.981628251748.issue15814@psf.upfronthosting.co.za>
In-reply-to
Content
It is perfectly possible for an object to export memory in a read-only way that may still change. Another object may have a writeable view:

x = obj.readonly_view
y = obj.writable_view
obj.move_to_next_image() # changes memory under x, y

So, hashing using tobytes() doesn't make any sense at all to me. A memoryview != its contents.

You could compare memoryviews simply by comparing the Py_buffer structure, but that's going to be confusing for a lot of users. I would really prefer unhashable (+ if needed a method for comparing contents).

(FWIW, not sure how relevant this is; in NumPy, == does 

In [1]: np.array([1,2,3]) == np.array([1,3,3])
Out[1]: array([ True, False,  True], dtype=bool)

Cython will follow this behaviour for its "typed memory views", which is Cython's builting mechanism for PEP 3118 which is not quite the same as CPython "memoryview". But I understand that following this behaviour is probably out of the question for CPython.)
History
Date User Action Args
2012-08-31 03:31:31Dag.Sverre.Seljebotnsetrecipients: + Dag.Sverre.Seljebotn, loewis, georg.brandl, mark.dickinson, ncoghlan, belopolsky, pitrou, scoder, vstinner, christian.heimes, Arfrever, skrah, meador.inge
2012-08-31 03:31:31Dag.Sverre.Seljebotnsetmessageid: <1346383891.67.0.981628251748.issue15814@psf.upfronthosting.co.za>
2012-08-31 03:31:31Dag.Sverre.Seljebotnlinkissue15814 messages
2012-08-31 03:31:30Dag.Sverre.Seljebotncreate