Eric Matthes’s Python Crash Course, 3rd Edition takes a well-regarded text for getting started with Python and brings it up to date for 2023. The book not only covers Python’s basics but lets you put them to use in a series of projects involving data analysis, web development, and gaming. Many books offer either Python basics or projects to learn from. This one delivers both.
Python for beginners
According to the introduction, the target audience for Python Crash Course, 3rd Edition is “people of any age who have never programmed in Python or have never programmed at all.” That said, the appendices offer material one might find in a book aimed at a more professional audience, such as a quick rundown of using Git.
Python 3.9 is the language version used for examples in this third edition, which is a wise choice. Python 3.9 is universally supported and provides better and more detailed error messages than previous versions of Python—a massive boon for beginners. Examples in the book comment on Python’s expanded error traces for context.
The first half of the book is a crash course in Python proper. Readers will learn how to set up Python on a system (all the major operating systems are covered) and how to configure an editor. Microsoft’s Visual Studio Code is the book’s editor of choice, whereas previous editions used Sublime Text. All code examples are available through the author’s GitHub account.
No Starch Press books all have excellent readability, and this one is no exception. Code examples and error traces are easy to understand. “Try It Yourself” boxes offer quick exercises that help recap material that was just covered, encouraging readers to put their newfound knowledge to work.
Some introductory programming books introduce material in the wrong order, so that concepts that were previously introduced don’t develop the ones that come later. For the most part Python Crash Course, 3rd Edition is well laid out. Key concepts come in a sensible sequence—for instance,
int() are introduced in a logical order, so the user doesn’t make common beginner mistakes with string concatenation. The book also quickly makes distinctions between logical and syntax errors in Python, such as how indentation affects both of those things. I also liked that f-strings are introduced relatively early, so that string formatting problems all have a common solution.
Object-oriented programming and classes remain some of the trickiest concepts to explain to newly minted programmers. Python Crash Course, 3rd Edition does an admirable job of it. Right from the start, the book explains how classes are used to model real-world objects, with both “toy” examples like a dog and more realistic ones like a website user.
Tests and test frameworks
Tests and test frameworks don’t usually make it into a book like this one, but Python Crash Course, 3rd Edition has a whole chapter on writing tests by way of the third-party
pytest library. It also covers testing classes and writing fixtures for test environments, which paves the way toward more advanced uses of testing.
Python example projects
The example projects in the second half the book revolve around three common areas for Python: video games (PyGame), data visualizations (Matplotlib and Plotly), and web applications (Django). Django is significantly more complex than some other common web frameworks used for introductory projects, such as Flask, but the book takes the time to walk the reader through Django’s complexity. It also includes notes about working with the Bootstrap CSS framework to style projects.
Any introductory course to a language has to make hard decisions about what to cover and in what order. I had quibbles with how this book handled a few things in that vein, but they’re not fatal. For instance, exceptions are not covered on their own at first—they’re touched on in the chapter on classes, and then elaborated on further in the chapter on file handling. Similarly,
pip gets introduced along with installing
pytest, although that makes some sense since it’s the reader’s first encounter with a third-party package in the book.
For readers who want to get started with Python quickly, and get results, Python Crash Course 3rd Edition lives up to its name.
Copyright © 2023 IDG Communications, Inc.