Jolt Awards: The Best Books, September 23, 2014 The best books of the past 12 months.
Jolt Award: Python in Practice
by Mark Summerfield
Mark Summerfield's Python in Practice is a fascinating book intended for intermediate and advanced Python developers. Rather than being a primer, it attacks advanced issues in Python the ones that go beyond bread-and-butter programming. It imparts the skills that distinguish the expert from the journeyman. In other words, if you're a decent, but not yet great Python programmer, this is book is for you.
The first three chapters are a Python perspective on the Gang of Four (GoF) design patterns. In a dynamic language like Python, many of the problems the original design patterns aimed to solve look different or have a different subtext. Unlike the familiar, long-winded academic presentation of patterns, The author uses practical illustrations to explain the patterns' implementations in Python. The explanations are "what you need to know" and the code examples are concise and sufficient to illustrate the specific point Summerfield is making without spilling into tangentially related side arguments. This combination makes the patterns both more approachable and more likely to be used.
There follows an excellent chapter on concurrency, which discusses I/O versus CPU-bound concurrency and multithreading versus multiprocessing, including explanation of the famous Global Interpreter Lock (GIL).
A chapter on extending Python deals with one of Python's ostensible weaknesses its slow performance. The book presents multiple solutions for compiling Python to native code and calling C and C++ libraries directly. It drills deeply into the built-in ctypes module and Cython.
My one disappointment is the chapter on high-level networking. It focuses on remote procedure calls (RPCs) which represent an approach that has lost much of its appeal in recent years. Instead, I would have liked to see a chapter on low-level, socket-based programming and high-level REST/HTTP-based programming with proper Web API design.
The chapter on GUI programming is very good. The author presents the various options, discusses cross-platform concerns, and explains which projects/tools are active. This is important because choosing a GUI toolkit for a UI-intensive application is a decision you will typically have to live with for a long time. The author's experience in this area (he wrote the definitive book on Qt programming) serves him well. He goes on to demonstrate basic techniques, dialogs, and even a full game using Tkinter, the built-in cross-platform GUI toolkit that comes with Python.
The final chapter of the book further extends UI coverage by exploring 3D programming with OpenGL. Two different libraries are used: PyOpenGL and Pyglet.
Overall, the book has the right mix of high-level concepts, low-level details, and code samples. Its pragmatic treatment of useful topics, lucid explanations, succinct code, and careful attention to presentation make it an excellent book for intermediate to advanced Python developers and the Jolt Award winner for 2014.