Quantcast
Channel: identifying objects, why does the returned value from id(...) change? - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Answer by Tim McNamara for identifying objects, why does the returned value from id(...) change?

$
0
0

The same id for different variables is a product of how Python creates variables.

id is a hash of the the location of an object in memory. Python variables are references to an object, not new objects. If several variables reference the same object, they have the same `id.


Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>