On 28/01/2015 10:35 AM, Mario Figueiredo wrote:
I admit it was a contrived example. I couldn't think of a way to demonstrate that a class object does not participate in its own inheritance rules. Only instances of it can.
A class object isn't an instance of itself, it's an instance of the Class (to be extact, 'type') class. Method dispatching will also traverse the base classes when refering to the class object, too:
>>> class Master: ... @classmethod ... def func(cls): ... return cls ... >>> class Sub(Master): ... pass ... >>> type(Sub) <class 'type'> >>> Sub.func() <class '__main__.Sub'> -- https://mail.python.org/mailman/listinfo/python-list