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/2013-September/129108.html below:

[Python-Dev] peps: document requirements

[Python-Dev] peps: document requirements [Python-Dev] peps: document requirementsChristian Heimes christian at python.org
Mon Sep 30 21:31:10 CEST 2013
Am 30.09.2013 20:16, schrieb Antoine Pitrou:
> On Mon, 30 Sep 2013 17:08:00 +0200 (CEST)
> christian.heimes <python-checkins at python.org> wrote:
>> +
>> +* It should return ``0`` for zero length input. (Note: This can be handled as
>> +  special case, too.)
> 
> What is this required for? The main requirement is that equal stuff
> hashes equal, but there's no reason for zero-length input to hash to
> zero, AFAIK.

http://hg.python.org/cpython/file/d7ba4ca59023/Objects/object.c#l852

    We make the hash of the empty string be 0, rather than using
    (prefix ^ suffix), since this slightly obfuscates the hash secret

It's not a hard requirement, hence 'should' instead of 'must' like in
all other cases.

Christian

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