Chapter 2. Types and Operators
This chapter begins our tour of the Python language. From an abstract perspective, in Python we write programs that do things with stuff.[8] Programs take the form of statements, which we’ll meet later. Here, we’re interested in the stuff our programs do things to. And in Python, stuff always takes the form of objects. They may be built-in kinds of objects Python provides for us, or objects we create using Python or C tools. Either way, we’re always doing things to objects in Python.
Naturally, there’s more to Python development than doing things to stuff. But since the subjects of Python programs are the most fundamental notion in Python programming, we start with a survey of Python’s built-in object types.
Python Program Structure
By way of introduction, let’s first get a clear picture of how what we study in this chapter fits into the overall Python picture. From a more concrete perspective, Python programs can be decomposed into modules, statements, and objects, as follows:
Programs are composed of modules.
Modules contain statements.
Statements create and process objects.
[8] Pardon our formality: we’re computer scientists.
Get Learning Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.