Data Structures and Algorithms with Object-Oriented Design Patterns in Python
next up previous index

Objects and Types

An object  is a programming language abstraction that represents a storage location. A Python object has the following attributes:

type
The type  of an object determines the set of values that the object can have and the set of operations that can be performed on that object.
value
The value  of an object is the content of the memory location(s) occupied by that variable. How the contents of the memory locations are interpreted is determined by the type of the variable.
lifetime
The lifetime  of an object is the interval of time in the execution of a Python program during which the object is said to exist.

Python defines an extensive type hierarchy. This hierarchy includes the numeric types (such as int, float and complex), sequences (such as tuple and list), functions (type function), classes and methods (types classobj and instancemethod), and and instances of classes (type instance).


next up previous index

Bruno Copyright © 2003, 2004 by Bruno R. Preiss, P.Eng. All rights reserved.