As shown in image output for id(y) and id(x[0]) is the same. How is it possible if id() is returning address of variables.
Asked
Active
Viewed 23 times
0
-
This is due to caching used by python. Python caches small integers. https://stackoverflow.com/questions/3402679/identifying-objects-why-does-the-returned-value-from-id-change – Ankur Sharma Aug 16 '17 at 05:10
-
1Possible duplicate of [identifying objects, why does the returned value from id(...) change?](https://stackoverflow.com/questions/3402679/identifying-objects-why-does-the-returned-value-from-id-change) – wmorrell Aug 16 '17 at 05:13
-
Then is it means that id() is not returning address?? – Rohan Arora Aug 16 '17 at 05:37