The new module allows an interface to the interpreter object creation functions. This is for use primarily in marshal-type functions, when a new object needs to be created ``magically'' and not by using the regular creation functions. This module provides a low-level interface to the interpreter, so care must be exercised when using this module. It is possible to supply non-sensical arguments which crash the interpreter when the object is used.
The new module defines the following functions:
class[, dict]) |
None
, a new, empty dictionary is
created for the new instance. Note that there are no guarantees that
the object will be in a consistent state.
function, instance, class) |
None
. function must be
callable.
code, globals[, name[, argdefs]]) |
None
. If it is a
string, the function will have the given name, otherwise the function
name will be taken from code.co_name
. If
argdefs is given, it must be a tuple and will be used to
determine the default values of parameters.
argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab) |
name) |
name, baseclasses, dict) |