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 skrah
Recipients Arfrever, Dag.Sverre.Seljebotn, belopolsky, christian.heimes, georg.brandl, loewis, mark.dickinson, meador.inge, ncoghlan, pitrou, python-dev, scoder, skrah, vstinner
Date 2012-09-01.14:24:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346509461.82.0.800548746043.issue15814@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-09-01 14:24:21skrahsetrecipients: + 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:21skrahsetmessageid: <1346509461.82.0.800548746043.issue15814@psf.upfronthosting.co.za>
2012-09-01 14:24:21skrahlinkissue15814 messages
2012-09-01 14:24:21skrahcreate