Message169636
Martin v. L??wis <report@bugs.python.org> wrote:
> Why be more permissive than necessary? -0 on the committed version;
> it should IMO further restrict it to 1D contiguous byte arrays.
Does "byte arrays" include 'b' and 'c' or just 'B'? I don't see a reason
to allow 'B' but not the others.
I'm +-0 on allowing multi-dimensional arrays, but it would be
odd to restrict hashing to contiguous arrays:
>>> b = b'abcdefhhijkl'
>>> m = memoryview(b)
>>> b[::-1]
b'lkjihhfedcba'
>>> bytes(m[::-1])
b'lkjihhfedcba'
>>> hash(b[::-1]) == hash(m[::-1])
True
My reasoning was: If non-contiguous arrays are allowed (and I think they
should be), why not allow multi-dimensional arrays, too?
The definition hash(m) == hash(m.tobytes()) is pretty straightforward. |
|
Date |
User |
Action |
Args |
2012-09-01 14:24:21 | skrah | set | recipients:
+ skrah, loewis, georg.brandl, mark.dickinson, ncoghlan, belopolsky, pitrou, scoder, vstinner, christian.heimes, Arfrever, meador.inge, python-dev, Dag.Sverre.Seljebotn |
2012-09-01 14:24:21 | skrah | set | messageid: <1346509461.82.0.800548746043.issue15814@psf.upfronthosting.co.za> |
2012-09-01 14:24:21 | skrah | link | issue15814 messages |
2012-09-01 14:24:21 | skrah | create | |
|