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 rhettinger
Recipients Jiajun Huang, rhettinger
Date 2017-01-08.02:16:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483841767.42.0.101211404539.issue29200@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, but I think you've missed the point of _HashedSeq.  The hash() is called no more than once per instance, not once per instance creation.

    >>> from functools import _HashedSeq
    >>> from unittest.mock import Mock
    >>> test_tup = 1, 2, 3, "hello", "world"
    >>> hash_func = Mock(return_value=999)
    >>> hs = _HashedSeq(test_tup, hash=hash_func)
    >>> hash(hs)
    999
    >>> hash(hs)
    999
    >>> hash(hs)
    999
    >>> hash_func.call_count
    1
History
Date User Action Args
2017-01-08 02:16:07rhettingersetrecipients: + rhettinger, Jiajun Huang
2017-01-08 02:16:07rhettingersetmessageid: <1483841767.42.0.101211404539.issue29200@psf.upfronthosting.co.za>
2017-01-08 02:16:07rhettingerlinkissue29200 messages
2017-01-08 02:16:07rhettingercreate