Christian Heimes <li...@cheimes.de> added the comment:

> But do they use them as dict keys? AFAIK strings aren't hashed until hash() 
> is called on them.

That's correct. The hash of str and bytes is calculated on demand and then 
cached.

Frozensets also cache their hash values while tuples don't have a cache. We ran 
experiments with hash caching in tuples many years ago. It turned out that the 
increased size had an overall negative effect on performance. This may have 
changed with modern hardware with more RAM and much larger CPU caches, though.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue29410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to