From the python document the id() function:
Return the “identity” of an object. This is an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.
CPython implementation detail: This is the address of the object in memory.
This is clear, I understand it. It a python class instance is passed to id function, it returns the “identity” / address of that object. However, if a python class name is passed to id function. What does it return? From example.
class Abc:
value = 0
x = Abc()
id(x) # -> 65097560
id(Abc) # -> 67738424
I understand 65097560 is the memory address of object x. but what is the meaning of id(Abc) / 67738424?
ABC. Since everything is an object you can even get the identity of functions e.g.print(id(abs)). - MatthiasAbcis just an instance oftype, which you can observe by evaluatingtype(Abc). - chepnerid(id):-) - Kelly Bundytypeinstance object, just as it is with other objects. - Prune