Why doesn't Python hash function give the same values when run on Android implementation?

前端 未结 5 723
-上瘾入骨i
-上瘾入骨i 2020-12-09 15:44

I believed that hash() function works the same in all python interpreters. But it differs when I run it on my mobile using python for android. I get same hash v

5条回答
  •  佛祖请我去吃肉
    2020-12-09 16:26

    With CPython, for efficiency reason hash() on internal objects returns the same value as id() which in its turn return the memory location ("address") of the object.

    From one CPython-based interpreter to an other memory location of such object is subject to change. Depending on your OS, this could change from one run to an other.

提交回复
热议问题