It is based on None's id
, but None is one of a few Python objects that are defined as C global variables, so its address (typically) doesn't change between Python runs. Other such objects are True
and False
(but these are hashed as ints), or built-in classes like object
and tuple
.
The address (and hash) is different between different CPython builds, however. On my system, hash(None)
gives 539708.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…