[Python-Dev] peps: document requirements (original) (raw)
Christian Heimes christian at python.org
Mon Sep 30 21:31:10 CEST 2013
- Previous message: [Python-Dev] peps: document requirements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] peps: document requirements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]