I'm trying to figure out how the comparison type(v) == int
works in Python (and why should I use is
instead of ==
in this case), for what I've been reading about classes and metaclasses in Python, but still I don't know exactly what happens (what is being compare exactly) when you compare two classes (classes themselves, not instances). I supposed that the answer would be in the definition of the equals method of the type
metaclass, which is the class of int
and type(v)
, so I would like to see the source code of that definition but I haven't been able to find it yet.
So, please, could anybody point me to the exact definition of the method or explain to me what is happening under the hood when I compare two classes (two instances of the type
metaclass/class)?