Am 30.09.2013 20:16, schrieb Antoine Pitrou: > On Mon, 30 Sep 2013 17:08:00 +0200 (CEST) > christian.heimes <python-check...@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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com