Mastering Object-oriented Python

Mastering Object-oriented PythonReviews
Author: Steven Lott
Pub Date: 2014
ISBN: 978-1-78328-097-1
Pages: 634
Language: English
Format: PDF
Size: 10 Mb


Grasp the intricacies of object-oriented programming in Python in order to efficiently build powerful real-world applications
If you want to master object-oriented Python programming this book is a must-have. With 750 code samples and a relaxed tutorial, it’s a seamless route to programming Python.
This practical example-oriented guide will teach you advanced concepts of object-oriented programming in Python. This book will present detailed examples of almost all of the special method names that support creating classes that integrate seamlessly with Python’s built-in features. It will show you how to use JSON, YAML, Pickle, CSV, XML, Shelve, and SQL to create persistent objects and transmit objects between processes. The book also covers logging, warnings, unit testing, configuration files, and how to work with the command line.
This book is broken into three major parts: Pythonic Classes via Special Methods; Persistence and Serialization; Testing, Debugging, Deploying, and Maintaining. The special methods are broken down into several focus areas: initialization, basics, attribute access, callables, contexts, containers, collections, numbers, and more advanced techniques such as decorators and mixin classes.
What You Will Learn

  • Understand the different design patterns for the __init__() method
  • Discover the essential features of Python 3’s abstract base classes and how you can use them for your own applications
  • Design callable objects and context managers that leverage the with statement
  • Perform object serialization in formats such as JSON, YAML, Pickle, CSV, and XML
  • Employ the Shelve module as a sophisticated local database
  • Map Python objects to a SQL database using the built-in SQLite module
  • Transmit Python objects via RESTful web services
  • Devise strategies for automated unit testing, including how to use the doctest and the unittest.mock module
  • Parse command-line arguments and integrate this with configuration files and environment variables

Table of Contents

Part 1: Pythonic Classes via Special Methods
1: The __init__() Method
2: Integrating Seamlessly with Python – Basic Special Methods
3: Attribute Access, Properties, and Descriptors
4: The ABCs of Consistent Design
5: Using Callables and Contexts
6: Creating Containers and Collections
7: Creating Numbers
8: Decorators and Mixins – Cross-cutting Aspects

Part 2: Persistence and Serialization
9: Serializing and Saving – JSON, YAML, Pickle, CSV, and XML
10: Storing and Retrieving Objects via Shelve
11: Storing and Retrieving Objects via SQLite
12: Transmitting and Sharing Objects
13: Configuration Files and Persistence

Part 3: Testing, Debugging, Deploying, and Maintaining
14: The Logging and Warning Modules
15: Designing for Testability
16: Coping With the Command Line
17: The Module and Package Design
18: Quality and Documentation