I was reading about this excellent post on metaclasses What is a metaclass in Python?. The accepted answer shows how to create a class using type with the following signature.
type(name of the class,
tuple of the parent class (for inheritance, can be empty),
dictionary containing attributes names and values)
That makes me wonder who creates the object class. Is object class also created by type class?
In theory you are correct.
objectis an instance oftype. But, when you checktype‘s base classes, you’ll find thattypeinherits fromobject! How can this be?The truth is, this is hard-coded in the Python interpreter. Both
objectandtypeare given; neither is actually involved in any way with creating the other.