I've consulted documentation and this question but confused how to move forward with these. I provide a brief recap before I ask my question.
Brief recap
1 - Everything in python is an instance of a class. This can be confirmed with using
x.__class__
where x can be anything!
2 - Every class is subclass of "object". This can be confirmed with
x.__class__.__mro__
where x can be anything!
3 - Every class itself (refer to point 1) is instance of a class called "type". This can be confirmed by
x.__class__.__class__
where x can be anything!
My Question
How can you implement such a logic?!
1- "type" itself is a class, so point 3 alone is confusing! "type", as a class, is an instance of itself!
type.__class__.__class__ == type
2- point 3 together with point 2 is also confusing! When you want to implement "type", you need "object" to be implemented to derive from it! But in order to have "object" as an instance, you need "type" to be implemented!
How such a thing possible to practically implement?!
object.__class__.__mro__[-1] == object