The type
keyword is a class. You can perform the above using
module[name] = type(name, (base_class,), d)
This will return a class of name name
with the tuple parameters of the base class base_class
, initializing the member objects with the dict
d
.