小编eda*_*ley的帖子

使用对象的 id() 作为哈希值

__hash__像这样实施是个坏主意吗?

class XYZ:
    def __init__(self):
        self.val = None

    def __hash__(self):
        return id(self)
Run Code Online (Sandbox Code Playgroud)

我是否设置了一些潜在的灾难性的东西?

python hash

5
推荐指数
1
解决办法
601
查看次数

标签 统计

hash ×1

python ×1