Mastering Object-oriented Python
- Length: 634 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2014-04-25
- ISBN-10: 1783280972
- ISBN-13: 9781783280971
- Sales Rank: #817132 (See Top 100 Books)
Grasp the intricacies of object-oriented programming in Python in order to efficiently build powerful real-world applications
Overview
- Create applications with flexible logging, powerful configuration and command-line options, automated unit tests, and good documentation.
- Use the Python special methods to integrate seamlessly with built-in features and the standard library
- Design classes to support object persistence in JSON, YAML, Pickle, CSV, XML, Shelve, and SQL
In Detail
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 from this book
- 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
Approach
This book follows a standard tutorial approach with approximately 750 code samples spread through the 19 chapters. This amounts to over 5,900 lines of code that illustrate each concept.
Table of Contents
Part 1: Pythonic Classes via Special Methods
Chapter 1: The __init__() Method
Chapter 2: Integrating Seamlessly with Python – Basic Special Methods
Chapter 3: Attribute Access, Properties, and Descriptors
Chapter 4: The ABCs of Consistent Design
Chapter 5: Using Callables and Contexts
Chapter 6: Creating Containers and Collections
Chapter 7: Creating Numbers
Chapter 8: Decorators and Mixins – Cross-cutting Aspects
Part 2: Persistence and Serialization
Chapter 9: Serializing and Saving – JSON, YAML, Pickle, CSV, and XML
Chapter 10: Storing and Retrieving Objects via Shelve
Chapter 11: Storing and Retrieving Objects via SQLite
Chapter 12: Transmitting and Sharing Objects
Chapter 13: Configuration Files and Persistence
Part 3: Testing, Debugging, Deploying, and Maintaining
Chapter 14: The Logging and Warning Modules
Chapter 15: Designing for Testability
Chapter 16: Coping With the Command Line
Chapter 17: The Module and Package Design
Chapter 18: Quality and Documentation
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Mastering Object-oriented Python
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.