Jump to ratings and reviews
Rate this book

Mastering Object-Oriented Python: Build powerful applications with reusable code using OOP design patterns and Python 3.7, 2nd Edition

Rate this book

Gain comprehensive insights into programming practices, and code portability and reuse to build flexible and maintainable apps using object-oriented principles

Key Features Extend core OOP techniques to increase integration of classes created with Python Explore various Python libraries for handling persistence and object serialization Learn alternative approaches for solving programming problems, with different attributes to address your problem domain Book Description

Object-oriented programming (OOP) is a relatively complex discipline to master, and it can be difficult to see how general principles apply to each language's unique features. With the help of the latest edition of Mastering Objected-Oriented Python, you'll be shown how to effectively implement OOP in Python, and even explore Python 3.x.

Complete with practical examples, the book guides you through the advanced concepts of OOP in Python, and demonstrates how you can apply them to solve complex problems in OOP. You will learn how to create high-quality Python programs by exploring design alternatives and determining which design offers the best performance. Next, you'll work through special methods for handling simple object conversions and also learn about hashing and comparison of objects. As you cover later chapters, you'll discover how essential it is to locate the best algorithms and optimal data structures for developing robust solutions to programming problems with minimal computer processing. Finally, the book will assist you in leveraging various Python features by implementing object-oriented designs in your programs.

By the end of this book, you will have learned a number of alternate approaches with different attributes to confidently solve programming problems in Python.

What you will learn Explore a variety of different design patterns for the __init__() method Learn to use Flask to build a RESTful web service Discover SOLID design patterns and principles Use the features of Python 3's abstract base Create classes for your own applications Design testable code using pytest and fixtures Understand how to design context managers that leverage the 'with' statement Create a new type of collection using standard library and design techniques Develop new number types above and beyond the built-in classes of numbers Who this book is for

This book is for developers who want to use Python to create efficient programs. A good understanding of Python programming is required to make the most out of this book. Knowledge of concepts related to object-oriented design patterns will also be useful.

Table of Contents Preliminaries, Tools, and Techniques The __init__() Method Integrating Seamlessly - Basic Special Methods Attribute Access, Properties, and Descriptors The ABCs of Consistent Design Using Callables and Contexts Creating Containers and Collections Creating Numbers Decorators and Mixins - Cross-cutting Aspects Serializing and Saving - JSON, YAML, Pickle, CSV, and XML Storing and Retrieving Objects via Shelve Storing and Retrieving Objects via SQLite Transmitting and Sharing Objects Configuration Files and Persistence Design Principles and Patterns The Loggin

770 pages, Kindle Edition

First published January 1, 2014

57 people are currently reading
116 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.