Message169347
| Author |
skrah |
| Recipients |
Arfrever, christian.heimes, georg.brandl, loewis, mark.dickinson, meador.inge, ncoghlan, pitrou, python-dev, skrah, vstinner |
| Date |
2012年08月29日.07:36:18 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1346225781.19.0.133913261897.issue15573@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|