我试图理解背后的基本机制
hash(itertools.count(x, y))
.
我不习惯深入研究CPython的实现,但我注意到
itertoolsmodule.c
这个
static PyTypeObject count_type
has
0
for
tp_hash
.
我假设这意味着它没有实施
hash
在C.那么,它是如何处理的呢?C绑定是否有Python对象
itertools.count
实现
__hash__
?
另一方面,幕后发生了什么
itertools.count(0, 5) != itertools.count(0, 5)