Mastering Object-oriented Python (Paperback)
暫譯: 精通物件導向Python (平裝本)
Steven F. Lott
- 出版商: Packt Publishing
- 出版日期: 2014-04-21
- 售價: $2,010
- 貴賓價: 9.5 折 $1,910
- 語言: 英文
- 頁數: 634
- 裝訂: Paperback
- ISBN: 1783280972
- ISBN-13: 9781783280971
-
相關分類:
Python、程式語言、Object-oriented
已過版
買這商品的人也買了...
-
$1,590$1,511 -
$1,270$1,207 -
$1,220$1,159 -
$1,590$1,511
商品描述
For those who know the basics of object-oriented Python this book is a must-have. With 750 code samples and a relaxed tutorial approach, it’s the seamless route to more sophisticated programming.
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.
商品描述(中文翻譯)
對於已經了解物件導向 Python 基礎的人來說,這本書是必備之選。書中包含 750 個程式碼範例,並採用輕鬆的教學方式,是進階程式設計的無縫之路。
概述
- 創建具有靈活日誌記錄、強大配置和命令列選項、自動化單元測試以及良好文檔的應用程式。
- 使用 Python 特殊方法與內建功能和標準庫無縫整合
- 設計類別以支援 JSON、YAML、Pickle、CSV、XML、Shelve 和 SQL 的物件持久性
詳細內容
這本實用的範例導向指南將教你 Python 中物件導向程式設計的進階概念。本書將呈現幾乎所有支援創建與 Python 內建功能無縫整合的特殊方法名稱的詳細範例。它將展示如何使用 JSON、YAML、Pickle、CSV、XML、Shelve 和 SQL 來創建持久物件並在進程之間傳輸物件。本書還涵蓋日誌記錄、警告、單元測試、配置檔案以及如何使用命令列。
本書分為三個主要部分:透過特殊方法的 Pythonic 類別;持久性與序列化;測試、除錯、部署與維護。特殊方法被細分為幾個重點領域:初始化、基礎、屬性存取、可呼叫物件、上下文、容器、集合、數字,以及更進階的技術,如裝飾器和混合類別。
你將從這本書中學到什麼
- 了解 __init__() 方法的不同設計模式
- 發現 Python 3 抽象基類的基本特徵,以及如何將其用於自己的應用程式
- 設計可呼叫物件和利用 with 語句的上下文管理器
- 在 JSON、YAML、Pickle、CSV 和 XML 等格式中執行物件序列化
- 使用 Shelve 模組作為一個複雜的本地資料庫
- 使用內建的 SQLite 模組將 Python 物件映射到 SQL 資料庫
- 透過 RESTful 網路服務傳輸 Python 物件
- 制定自動化單元測試的策略,包括如何使用 doctest 和 unittest.mock 模組
- 解析命令列參數,並將其與配置檔案和環境變數整合
方法
本書採用標準的教學方法,約有 750 個程式碼範例分佈在 19 章中。這相當於超過 5,900 行程式碼,說明每個概念。