3

A Grab Bag of Python Gotchas

This chapter looks at concerns one encounters—and mistakes one might often make—strictly within the Python language itself. Like the prior two chapters on respectively looping and equality versus identity, these discussions are about the core of the Python language. Later chapters look at less common language constructs, less used or more specialized standard library modules, and some very common third-party modules.

While the discussions in this chapter are somewhat heterogeneous, they also address a few of the most failings real-world Python code encounters, in my experience. A fair number of the issues in this chapter reflect the use of habits developed for other programming languages that are less well suited ...

Get Better Python Code: A Guide for Aspiring Experts 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.