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 loewis
Recipients Alexander.Belopolsky, 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.17:44:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <50424964.8050806@v.loewis.de>
In-reply-to <20120901172023.GA16365@sleipnir.bytereef.org>
Content
Am 01.09.12 19:20, schrieb Stefan Krah:
> Disallowing non-contiguous arrays leads to very strange situations though.

I don't find that strange. That two object compare equal doesn't imply
that they both hash - only that *if* they hash, they should hash equal.

In any case, this can happen already:

py> x = memoryview(array.array('B',b'cba'))
py> b = b'cba'
py> d = {b'cba': 101}
py> b in d
True
py> x == b
True
py> x in d
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ValueError: cannot hash writable memoryview object

It can also happen with other types (although I had to look around
a bit):

py> x=set((1,2,3))
py> b=frozenset(x)
py> d={b:101}
py> b in d
True
py> x==b
True
py> x in d
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'set'

> 1) Allow bytes hashing at all: +0.5

+0

> 2) If 1) is allowed, then also non-contiguous hashing is allowed: +1

-1

> 3) Allow multi-dimensional hashing: +-0

-1
History
Date User Action Args
2012-09-01 17:44:06loewissetrecipients: + loewis, georg.brandl, mark.dickinson, ncoghlan, belopolsky, pitrou, scoder, vstinner, christian.heimes, Arfrever, skrah, meador.inge, Alexander.Belopolsky, python-dev, Dag.Sverre.Seljebotn
2012-09-01 17:44:06loewislinkissue15814 messages
2012-09-01 17:44:05loewiscreate