Message169347
We overlooked one thing. Since hashing is defined in terms of
tobytes(), the equality-hash invariant is now broken:
>>> from _testbuffer import ndarray
>>> x = ndarray([1,2,3], shape=[3], format='f')
>>> y = ndarray([1,2,3], shape=[3], format='B')
>>> a = memoryview(x)
>>> b = memoryview(y)
>>> a == b
True
>>> hash(a) == hash(b)
False
>>>
This is one problem with the new equality definition. It puts
"memoryview" firmly into array territory. I'm not saying that's
wrong, I even think it was the intention of the PEP authors to
have a zero copy "arrayview".
Both array.array and numpy.array sidestep the issue by not being
hashable.
I don't really see a way around all this except doing slow
element-wise hashing. |
|
Date |
User |
Action |
Args |
2012-08-29 07:36:21 | skrah | set | recipients:
+ skrah, loewis, georg.brandl, mark.dickinson, ncoghlan, pitrou, vstinner, christian.heimes, Arfrever, meador.inge, python-dev |
2012-08-29 07:36:21 | skrah | set | messageid: <1346225781.19.0.133913261897.issue15573@psf.upfronthosting.co.za> |
2012-08-29 07:36:20 | skrah | link | issue15573 messages |
2012-08-29 07:36:19 | skrah | create | |
|