type() of an old-style class

types.ClassType

added 2012-06-02T19:58:07Z by anders

__metaclass__

We can provide a custom metaclass by setting __metaclass__ in a class definition to any callable that takes the same arguments as type.

added 2012-06-02T19:58:07Z by anders

type(name, bases, dict) creates a new type

When the Python interpreter executes a class statement […], it calls type with the following arguments:

  • The name of the class as a string
  • A tuple of base classes - for our example this is the ‘one-pl’ 1
  • A dictionary containing members of the class (class attributes, methods, etc) mapped by their names

added 2012-06-02T19:58:07Z by anders