0

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.

image

wmorrell
  • 4,988
  • 4
  • 27
  • 37
  • 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
  • 1
    Possible 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

0 Answers0