I am reading Learning python. Regarding metaclass, the book said type is an object and also is itself class. I am trying to search python doc online but don't see any similar description. Can someone point me any official doc?
Thinking a bit more on this statement that type is both object and class, I think it makes sense.
The reasons are as following.
- type is callable, seeing type(). Then it should be either a function or object which has implemented call
- any object is instanced from a class. Given it's in the top hierarchy, it makes sense that its class is itself.
My second question is that metaclass is subclass of type class? Is it still true that metaclass is also an instance of type object/class? Because when Metaclass(...) is invoked, type.call is invoked then Metaclass must be instance of type