Re: [Python-ideas] [Python-Dev] Python 3.x and bytes
Martin v. Löwis wrote [from python-dev]:
Immutable objects that compare equal should hash equal; so we would also have to change the hashing of byte strings. Not sure whether that, in turn, has undesirable consequences.
I thought it was the other-way-round -- if they hash equal, they should compare equal? Or is this just for immutables?
In addition, equality should be transitive, so b'A' == 65.0.
I'm not sure what you're getting at... we could certainly have step 2 check for a number instead of an int, and then step 3 could extract the one element, giving an int, and then let that int compare itself with the other number, whether it be int, float, fraction, what-have-you. ~Ethan~
On Wed, May 18, 2011 at 5:11 PM, Ethan Furman
I thought it was the other-way-round -- if they hash equal, they should compare equal? Or is this just for immutables?
Two values that compare equal must have equal hashes. Having equal hashes does not imply equality. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> "Give me the luxuries of life and I will willingly do without the necessities." --Frank Lloyd Wright
participants (2)
-
Ethan Furman
-
Fred Drake