【发布时间】:2011-02-10 21:12:16
【问题描述】:
我定义了一个类:
A类: ''' 哈希测试类 >>> a = A(9, 1196833379, 1, 1773396906) >>> 哈希(一) -340004569 这很奇怪,预期为 12544897317L。 ''' def __init__(self, a, b, c, d): 自我.a = a 自我.b = b 自我.c = c 自我.d = d def __hash__(self): 返回 self.a * self.b + self.c * self.d为什么,在 doctest 中,hash() 函数给出一个负整数?
【问题讨论】: