Swipe to navigate through the chapters of this book
By now, I’m sure you are getting a bit impatient. All right—all these data types are just dandy, but you can’t really do much with them, can you?
Please log in to get access to this content
To get access to this content you need the following product:
This will work only in a script, and not in an interactive Python session. In the interactive session, each statement will be executed (and print its contents) separately.
At least when we’re talking about built-in types—as you see in Chapter 9, you can influence whether objects you construct yourself are interpreted as true or false.
As Python veteran Laura Creighton puts it, the distinction is really closer to something vs. nothing, rather than true vs. false.
In fact, you can supply exec with two namespaces, one global and one local. The global one must be a dictionary, but the local one may be any mapping. The same holds for eval.
- Conditionals, Loops, and Some Other Statements
Magnus Lie Hetland
- Sequence number
- Chapter number
- Chapter 5