This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients amaury.forgeotdarc, belopolsky, benjamin.peterson, georg.brandl, gvanrossum, pitrou
Date 2008-04-17.03:11:39
SpamBayes Score 0.029117484
Marked as misclassified No
Message-id <d38f5330804162011h24d17f4fm7e707d595f90313@mail.gmail.com>
In-reply-to <1208395470.68.0.875423706037.issue2603@psf.upfronthosting.co.za>
Content
On Wed, Apr 16, 2008 at 9:24 PM, Benjamin Peterson wrote:
..
> Why not just hash a tuple?

There are a few reasons, but neither is good enough to have another
round of code review :-)

1. It is strange to have the hash function allocate new objects.  If
that was a type frequently used as a dict key, I would be concerned
about a possibility that dictionary lookup may trigger gc.

2. While reproducing hash(tuple) is a good starting point, there may
be a reason to choose different values for the magic constants.

3. If you don't want to mess with hash(tuple) complexity, a simple xor
of start/stop/step hashes (maybe with a check to prevent accidental -1
return) should be good enough.
History
Date User Action Args
2008-04-17 03:11:41belopolskysetspambayes_score: 0.0291175 -> 0.029117484
recipients: + belopolsky, gvanrossum, georg.brandl, amaury.forgeotdarc, pitrou, benjamin.peterson
2008-04-17 03:11:40belopolskylinkissue2603 messages
2008-04-17 03:11:39belopolskycreate