First page Back Continue Last page Overview Graphics

type, __new__ and __init__

Generally speaking, this means, that we can define a class A with:

type(classname, superclasses, attributedict)

If we call „type“, the call method of type is called.

The call method runs two other methods: new and init.

type.__new__(typeclass, classname, superclasses, attributedict)

type.__init__(cls, classname, superclasses, attributedict)

The new method creates and returns the new class object. And after this the init method initializes the newly created object.