Message10585

Author lsenta
Recipients lsenta
Date 2016-01-04.15:36:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1451921766.63.0.466045173289.issue2451@psf.upfronthosting.co.za>
In-reply-to
Content
I'm trying to use ByteArrays in a dict and I get duplicated keys,
It appears that in Jython bytearray can be hashed (not in regular python 2.7) but the hash is not consistent with the equality operator:

>>> from array import array
>>> xs = [
array('b', [99, 111, 117, 110, 116, 45, 105, 116, 101, 109, 115]),
array('b', [99, 111, 117, 110, 116, 45, 105, 116, 101, 109, 115]),
array('b', [98, 121, 116, 101, 45, 115, 105, 122, 101])
]

>>> xs[0] == xs[1]
True
>>> xs[0] == xs[2]
False
>>> map(hash, xs)
[1363822052, 1722768342, 576563150]
History
Date User Action Args
2016-01-04 15:36:06lsentasetrecipients: + lsenta
2016-01-04 15:36:06lsentasetmessageid: <1451921766.63.0.466045173289.issue2451@psf.upfronthosting.co.za>
2016-01-04 15:36:06lsentalinkissue2451 messages
2016-01-04 15:36:06lsentacreate