Message284951
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 |
|
Date |
User |
Action |
Args |
2017-01-08 02:16:07 | rhettinger | set | recipients:
+ rhettinger, Jiajun Huang |
2017-01-08 02:16:07 | rhettinger | set | messageid: <1483841767.42.0.101211404539.issue29200@psf.upfronthosting.co.za> |
2017-01-08 02:16:07 | rhettinger | link | issue29200 messages |
2017-01-08 02:16:07 | rhettinger | create | |
|