I found a strange thing in Python when I tried to compare lists composed of integers.
For example:
In [35]: id(range(1,5)),id(range(1,15)),id(range(16,0,-1))
Out[35]: (155687404, 155687404, 155687404)
Q1:
Why their id() values are the same? And how can they be the same since they look different?
Q2:
How can I compare lists of integers by id() values?
Q3:
To be more inquisitive, how is the id() value computed in Python?
Directly from python’s doc:
You could get the md5 hash to compare theese objects: