Review of Mastering Object Oriented Python

Today I give a somewhat overdue review of “Mastering Object-oriented Python” by Steven Lott, an active contributor to the StackOverflow forum. The book is on the long side with more than 600 pages.
This is an excellent advanced to intermediate Python book by Packt Publishing and covers special Python methods, decorators, serialization, unit testing and documentation.

Readers of this blog can win a free copy of this book for a limited period (details at the bottom of the page).

The following is a quick overview of the chapters:

  • Chapter 1: The __init__() Method describes the __init__() method and alternatives.
  • Chapter 2: Integrating Seamlessly with Python – Basic Special Methods takes a look at the __repr__(), __format__(), __hash__() and other methods.
  • Chapter 3: Attribute Access, Properties, and Descriptors is about class attributes and tells programmers coming from other languages about Python’s approach, which doesn’t involve private attributes and setter/getter methods.
  • Chapter 4: The ABCs of Consistent Design talks about abstract base classes (ABC) using the running Blackjack example.
  • Chapter 5: Using Callables and Contexts gives tips for the usage of context managers.
  • Chapter 6: Creating Containers and Collections goes over built-in class definitions.
  • Chapter 7: Creating Numbers teaches us about numeric types. Of course if you are a NumPy user, you know a better alternative than what “pure Python” has to offer.
  • Chapter 8: Decorators and Mixins – Cross-cutting Aspects mentions decoratorators and aspect oriented concepts. Personally I like AOP, so this was an interesting chapter.
  • Chapter 9: Serializing and Saving – JSON, YAML, Pickle, CSV, and XML is the first chapter of a series of chapters on persistence.
  • Chapter 10: Storing and Retrieving Objects via Shelve gives an overview of the Python shelve module and related operations.
  • Chapter 11: Storing and Retrieving Objects via SQLite explains how to access and work with SQLite.
  • Chapter 12: Transmitting and Sharing Objects guides us through the creation of a REST service.
  • Chapter 13: Configuration Files and Persistence is the last chapter on persistence and covers configuration files.
  • Chapter 14: The Logging and Warning Modules is a chapter on logging.
  • Chapter 15: Designing for Testability is about the important subject of unit testing including mocking and test suites.
  • Chapter 16: Coping With the Command Line helps with the development of command line applications.
  • Chapter 17: The Module and Package Design gives tips on module and package design.
  • Chapter 18: Quality and Documentation is by far the most important chapter in the book, because how are we supposed to learn about your brilliant software if it’s not documented properly.

I am sure I haven’t done justice to the book in this short overview and with its 600 pages it may seem a bit daunting to read it completely, however if you are serious about Python coding, I think it’s well worth the effort.

The rules of the giveaway contest are simple. One free eBook copy will be provided by Packt publishing. They handle all the details. You can participate by leaving a comment on this page. The contest will run for 1 month until the 6th of September.

Share
Posted in Uncategorized | Leave a comment