[issue29200] is it a bug in `functools._HashedSeq`

2017-01-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: -> resolved ___ Python tracker ___ ___

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Jiajun Huang
Jiajun Huang added the comment: thanks for reply :) 2017年1月8日星期日,Roundup Robot 写道: > > Roundup Robot added the comment: > > New changeset 2e7e91785306 by Raymond Hettinger in branch 'default': > Issue #29200: Fix test to use self.assertEqual instead of py.test style >

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2e7e91785306 by Raymond Hettinger in branch 'default': Issue #29200: Fix test to use self.assertEqual instead of py.test style tests https://hg.python.org/cpython/rev/2e7e91785306 -- ___ Python tracker

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: To honor your report, I've added a test for this functionality. -- ___ Python tracker ___

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Roundup Robot
Roundup Robot added the comment: New changeset 52d3cbcf546f by Raymond Hettinger in branch 'default': Issue #29200: Add test for lru cache only calling __hash__ once https://hg.python.org/cpython/rev/52d3cbcf546f -- nosy: +python-dev ___ Python

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Raymond Hettinger
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,

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-07 Thread Jiajun Huang
New submission from Jiajun Huang: the class definition: class _HashedSeq(list): """ This class guarantees that hash() will be called no more than once per element. This is important because the lru_cache() will hash the key multiple times on a cache miss. """