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

types

The types module defines names for all the built-in object types. The contents of this module are often used in conjunction with the built-in isinstance() function and other type-related operations.

Many of the objects in the types module are available as built-ins. For example, the built-in functions int(), long(), complex(), bool(), list(), dict(), tuple(), slice(), str(), unicode(), xrange(), and file() are actually type objects (in fact, they are exactly the same objects as referenced in the types module). Therefore, it is never necessary to use the longer name. For instance, writing isinstance(x,int) is the same as isinstance(x,types.IntType).

The module defines the following types:

VariableDescription
BooleanTypeType of Boolean integers ...

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