I've been playing around with the built-in types in Python 3 for a bit and I've noticed that all classes are instances of the more general class type
, for example typing int.__class__.__name__
results in type
. The same goes for any user-generated class. However, type itself is of type type
- typing type.__class__.__name__
results in type
.
However, this does not make much sense to me. How can a class be an instance of itself? Why is type not an instance of object
, the most basic class of all? Or is this some low-level magic that is being hidden from the end user?