Raymond Hettinger added the comment:

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

----------
resolution:  -> not a bug
status: open -> closed

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

Reply via email to