First page Back Continue Last page Overview Graphics

Principle of operation

After the class definition has been processed, Python calls:

type(classname, superclasses, attributes_dict)

This is not the case, if a metaclass has been declared in the header. That is what we have done in our previous example.

Our classes Philosopher1, Philosopher2 and Philosopher3 have been hooked to the metaclass „EssentialAnswers“. That‘s why „EssentialAnswers“ will be called instead of type:

EssentialAnswer(classname, superclasses, attributes_dict)

To be precise, the arguments of the calls will be set to the following values:

EssentialAnswer('Philopsopher1',

(),

{'__module__': '__main__',

'__qualname__': 'Philosopher1'})