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 mark.dickinson
Recipients Rhamphoryncus, casevh, eric.smith, mark.dickinson, rhettinger, skrah
Date 2010-04-21.13:47:35
SpamBayes Score 5.1665077e-09
Marked as misclassified No
Message-id <1271857658.31.0.217589954276.issue8188@psf.upfronthosting.co.za>
In-reply-to
Content
> Regarding a hash function for complex types, I think documenting the 
> existing behavior for PyComplex is sufficient. The magic number 1000003 > could be documented in hash_info as 'multiplier' and _PyHASH_MULTIPLIER. 

Seems reasonable;  I'm tempted to call the constant it hash_info.imaginary and _PyHASH_IMAGINARY, though.  :)  

There's also an implicit parameter in this algorithm, namely the size of a C long;  I think this should go into sys.hash_info, too.

complex_hash does need fixing in one respect:  it currently depends on signed overflow wrapping modulo 2**BIT_IN_LONG, but that's undefined behaviour;  it should use unsigned arithmetic instead.

> I think hash(m/P) should preserve sign. It just seems more symmetrical. :)

Agreed.  Along similar lines, I think I'm also going to get rid of _PyHASH_NINF and just use -PyHASH_INF instead.
History
Date User Action Args
2010-04-21 13:47:38mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, Rhamphoryncus, casevh, eric.smith, skrah
2010-04-21 13:47:38mark.dickinsonsetmessageid: <1271857658.31.0.217589954276.issue8188@psf.upfronthosting.co.za>
2010-04-21 13:47:35mark.dickinsonlinkissue8188 messages
2010-04-21 13:47:35mark.dickinsoncreate