A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-May/111475.html below:

[Python-Dev] Python 3.x and bytes

[Python-Dev] Python 3.x and bytes"Martin v. Löwis" martin at v.loewis.de
Wed May 18 23:58:21 CEST 2011
>> 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?

No no no. If they hash equal, it could just be a hash collision -
objects of a class could all hash to 42, if they wanted to.
Dictionaries require the property I mentioned. If they compare
equal, but hash differently, a dictionary lookup would fail to
find the key.

>> In addition, equality should be transitive, so b'A' == 65.0.
> 
> I'm not sure what you're getting at...

That it is counter-intuitive to have a bytes object compare equal
to a floating-point number.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4