Books

Books : reviews

David Beazley, Brian K. Jones.
Python Cookbook: 3rd edn.
O'Reilly. 2013

rating : 2.5 : great stuff
review : 29 November 2024

If you need help writing programs in Python 3, or want to update older Python 2 code, this book is just the ticket. Packed with practical recipes written and tested with Python 3.3, this unique cookbook is for experienced Python programmers who want to focus on modern tools and idioms.

Inside, you’ll find complete recipes for more than a dozen topics, covering the core Python language as well as tasks common to a wide variety of application domains. Each recipe contains code samples you can use in your projects right away, along with a discussion about how and why the solution works.

Topics include:

• Data Structures and Algorithms
• Strings and Text
• Numbers, Dates, and Times
• Iterators and Generators
• Files and l/O
• Data Encoding and Processing Functions
• Classes and Objects
• Metaprogramming
• Modules and Packages
• Network and Web Programming
• Concurrency
• Utility Scripting and System Administration
• Testing, Debugging, and Exceptions
• C Extensions

This book highlights features of Python 3 in a series of recipies. It covers all aspects, from relatively simple string and file handling, through the power of iterators and generators, into the more advanced decorators and metaprogramming. Each recipe is stated concisely as a problem (more of a task, really, as it often turns out not to be a problem at all) followed by a solution (surprisingly often: ‘use this library’), then a discussion of some tricky corner cases and more murky depths.

This is not a tutorial: it is assumed the reader is a relatively experienced Python programmer. For parts of the language you know, the recipes provides an excellent solutions. For parts yet to be explored, the recipes provide exciting hints of what is possible, but further reading will be needed. There’s something here for every Python programmer.