O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

new

The new module is used to create various types of objects used by the interpreter. The primary use of this module is by applications that need to create objects in a nonstandard manner (such as when unmarshalling data).

instance(class, dict)

Creates an old-style class instance of class with dictionary dict without calling the __init__() method. Does not work with classes that inherit from object (new-style classes).

instancemethod(function, instance, class)

Creates a method object, bound to instance.function must be a callable object. If instance is None, an unbound instance method is created.

function(code, globals [, name [, argdefs]])

Creates a function object with the given code object and global namespace. name is the name of the function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required