Message169497
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.) |
|
Date |
User |
Action |
Args |
2012-08-31 03:31:31 | Dag.Sverre.Seljebotn | set | recipients:
+ Dag.Sverre.Seljebotn, loewis, georg.brandl, mark.dickinson, ncoghlan, belopolsky, pitrou, scoder, vstinner, christian.heimes, Arfrever, skrah, meador.inge |
2012-08-31 03:31:31 | Dag.Sverre.Seljebotn | set | messageid: <1346383891.67.0.981628251748.issue15814@psf.upfronthosting.co.za> |
2012-08-31 03:31:31 | Dag.Sverre.Seljebotn | link | issue15814 messages |
2012-08-31 03:31:30 | Dag.Sverre.Seljebotn | create | |
|