Planning a Python Course for Beginners

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Aug 10 19:18:57 EDT 2017


Steve D'Aprano wrote:
> On 2017年8月10日 07:00 pm, Peter Otten wrote:
>>> /* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
>> excessive hash collisions for dicts and sets */
>> which I think agrees with my comment: using the id() itself would put too many
> objects in the same bucket (i.e. too many collisions).

I suspect this is more of a minor performance tweak than a vital
issue. Otherwise it would mean that dict's algorithm for
assigning items to buckets based on the hash isn't all that
great.
-- 
Greg


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /