Jump to ratings and reviews
Rate this book

Mastering Object-Oriented Python

Rate this book
An object-oriented approach to Python web development gives you a much more fully-realised experience of the language. The flexibility and power of Python, combined with the improvements in design, coding and software maintenance that object-oriented programming allows, is built to respond to the challenges of increasingly more complex and data-intensive application development, making difficult tasks much more manageable. This book has been designed to make this sophisticated approach to programming easier to learn quickly, providing you with a clear and coherent learning journey. Beginning by looking at a range of design patterns for the _init_() method, you will learn how to effectively use a range of Python’s special methods to create classes that integrate with Python’s built-in features, and find detailed explorations and demonstrations of callables and contexts, containers and collections, numbers, and decorators and mixins, with a focus on best practices for effective and successful design. The book also features information that demonstrates how to create persistent objects using JSON, YAML, Pickle, CSV, XML, Shelve and SQL and shows you how to transmit objects between processes. Going further into OOP, you’ll find expert information on logging, warnings, unit testing as well as working with the command line. Structured in 3 parts to make the complexity of OOP more manageable - Pythonic Classes via Special Methods, Persistence and Serialization and Testing, Debugging, Deploying, and Maintaining - this book offers deep insight into OOP that will help you develop expert level object-oriented Python skills.

634 pages, Kindle Edition

First published January 1, 2014

57 people are currently reading
117 people want to read

About the author

Steven F. Lott

18 books6 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
7 (18%)
4 stars
17 (45%)
3 stars
11 (29%)
2 stars
2 (5%)
1 star
0 (0%)
Displaying 1 - 3 of 3 reviews
Profile Image for Ivan Idris.
Author 14 books26 followers
August 6, 2014
This is an excellent advanced to intermediate Python book by Packt Publishing and covers special Python methods, decorators, serialization, unit testing and documentation.


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.
Profile Image for M. .
212 reviews20 followers
August 21, 2021
A wonderful and enjoyable deep-dive into the advanced world of OOP-Py. Highly recommended for anyone with basic OOP-Knowledge looking to expand... way expand it!
230 reviews3 followers
December 30, 2015
There is a lot of stuff in there. However, I found some examples inconsistent, even the Black Jack game was a bit too much.
Displaying 1 - 3 of 3 reviews

Can't find what you're looking for?

Get help and learn more about the design.