Python’s Type Hierarchies

Figure 9-3 summarizes all the built-in object types available in Python and their relationships. We’ve looked at the most prominent of these; most of the other kinds of objects in Figure 9-3 correspond to program units (e.g., functions and modules) or exposed interpreter internals (e.g., stack frames and compiled code).

阅读 ‧ 电子书库

Figure 9-3. Python’s major built-in object types, organized by categories. Everything is a type of object in Python, even the type of an object!

The main point to notice here is that everything in a Python system is an object type and may be processed by your Python programs. For instance, you can pass a class to a function, assign it to a variable, stuff it in a list or dictionary, and so on.