內容簡介
《Python3麵嚮對象編程(第2版 影印版 英文版)》講解瞭類、數據封裝、繼承、多態、抽象和異常,著重強調瞭在一款設計良好的軟件開發過程中使用每個原則的時機。除瞭學習如何利用高層次的設計模式來創建可維護的應用程序,你還可以瞭解到字符串和文件處理的復雜性以及Python區分二進製數據和文本數據的方法。另外,單元測試的樂趣以及並發編程的難題也是少不瞭的。
書中更新瞭大量的內容,以反映齣近來核心Python庫的變化,這些新的特性在《Python3麵嚮對象編程(第2版 影印版 英文版)》備受贊譽的第1版麵世時還無法使用。除此之外,全書的結構也進行瞭重新調整和組織,提升瞭知識量,增強瞭閱讀體驗。
目標讀者如果你是初次接觸麵嚮對象編程技術,或是隻具備基本的Python技能,希望能夠深入學習如何正確地使用Python麵嚮對象編程技術來設計軟件,那麼《Python3麵嚮對象編程(第2版 影印版 英文版)》就是為你準備的。
你將從《Python3麵嚮對象編程(第2版 影印版 英文版)》中學到什麼通過創建類和定義方法來實現Python對象。
將相關的對象劃分成不同的類,通過類接口來描述這些對象的屬性和行為。
使用繼承來擴展類的功能。
明白什麼時候使用麵嚮對象特性,什麼時候不使用(後者更重要)。
瞭解什麼是設計模式,為什麼在Python中有這些不同的設計模式。
揭示單元測試的簡潔性及其在Python中的重要性。
理解Python3中常見的並發編程技術和陷阱。
探究用於開發大規模並發網絡係統的新模塊Async10。
作者簡介
Dusty Phillips,is a Canadian software developer and author currently living in Seattle, Washington. He has been active in the open source community for a decade and a half and programming in Python for nearly all of it. He cofounded the popular Puget Sound Programming Python meetup group; drop by and say hi if you're in the area.
目錄
Preface
Chapter 1: Object-oriented Desiqn
Introducing object-oriented
Objects and classes
Specifying attributes and behaviors
Data describes objects
Behaviors are actions
Hiding details and creating the public interface
Composition
Inheritance
Inheritance provides abstraction
Multiple inheritance
Case study
Exercises
Summary
Chapter 2: Objects in Python
Creating Python classes
Adding attributes
Making it do something
Talking to yourself
More arguments
Initializing the object
Explaining yourself
Modules and packages
Organizing the modules
Absolute imports
Relative imports
Organizing module contents
Who can access my data?
Third-party libraries
Case study
Exercises
Summary
Chapter 3: When Objects Are Alike
Basic inheritance
Extending built-ins
Overriding and super
Multiple inheritance
The diamond problem
Different sets of arguments
Polymorphism
Abstract base classes
Using an abstract base class
Creating an abstract base class
Demystifying the magic
Case study
Exercises
Summary
Chapter 4: Expecting the Unexpected
Raising exceptions
Raising an exception
The effects of an exception
Handling exceptions
The exception hierarchy
Defining our own exceptions
Case study
Exercises
Summary
Chapter 5: When to Use Object-oriented Programming
Treat objects as objects
Adding behavior to class data with properties
Properties in detail
Decorators - another way to create properties
Deciding when to use properties
Manager objects
Removing duplicate code
In practice
Case study
Exercises
Summary
Chapter 6: Python Data Structures
Empty objects
Tuples and named tuples
Named tuples
Dictionaries
Dictionary use cases
Using defaultdict
Counter
Lists
Sorting lists
Sets
Extending built-ins
Queues
FIFO queues
LIFO queues
Priority queues
Case study
Exercises
Summary
Chapter 7: Python Object-oriented Shortcuts
Python built-in functions
The len() function
Reversed
Enumerate
File I/O
Placing it in context
An alternative to method overloading
Default arguments
Variable argument lists
Unpacking arguments
Functions are objects too
Using functions as attributes
Callable objects
Case study
Exercises
Summary
Chapter 8: Strings and Serialization
Strings
String manipulation
String formatting
Escaping braces
Keyword arguments
Container Iookups
Object Iookups
Making it look right
Strings are Unicode
Converting bytes to text
Converting text to bytes
Mutable byte strings
Regular expressions
Matching patterns
Matching a selection of characters
Escaping characters
Matching multiple characters
Grouping patterns together
Getting information from regular expressions
Making repeated regular expressions efficient
Serializing objects
Customizing pickles
Serializing web objects
Case study
Exercises
Summary
Chapter 9: The Iterator Pattern
Design patterns in brief
Iterators
The iterator protocol
Comprehensions
List comprehensions
Set and dictionary comprehensions
Generator expressions
Generators
Yield items from another iterable
Coroutines
Back to log parsing
Closing coroutines and throwing exceptions
The relationship between coroutines, generators, and functions
Case study
Exercises
Summary
Chapter 10: Python Design Patterns I
The decorator pattern
A decorator example
Decorators in Python
The observer pattern
An observer example
The strategy pattern
A strategy example
Strategy in Python
The state pattern
A state example
State versus strategy
State transition as coroutines
The singleton pattern
Singleton implementation
The template pattern
A template example
Exercises
Summary
Chapter 11: Python Design Patterns II
The adapter pattern
The facade pattern
The flyweight pattern
The command pattern
The abstract factory pattern
The composite pattern
Exercises
Summary
Chapter 12: Testing Object-oriented Programs
Why test?
Test-driven development
Unit testing
Assertion methods
Reducing boilerplate and cleaning up
Organizing and running tests
Ignoring broken tests
Testing with py.test
One way to do setup and cleanup
A completely different way to set up variables
Skipping tests with py.test
Imitating expensive objects
How much testing is enough?
Case study
Implementing it
Exercises
Summary
Chapter 13: Concurrency
Threads
The many problems with threads
Shared memory
The global interpreter lock
Thread overhead
Multiprocessing
Multiprocessing pools
Queues
The problems with multiprocessing
Futures
AsynclO
AsynclO in action
Reading an AsynclO future
AsynclO for networking
Using executors to wrap blocking code
Streams
Executors
Case study
Exercises
Summary
Index
Python3麵嚮對象編程(第2版 影印版 英文版) [Python 3 object-oriented Programming Second Edition] epub pdf mobi txt 電子書 下載 2024
Python3麵嚮對象編程(第2版 影印版 英文版) [Python 3 object-oriented Programming Second Edition] 下載 epub mobi pdf txt 電子書
Python3麵嚮對象編程(第2版 影印版 英文版) [Python 3 object-oriented Programming Second Edition] mobi pdf epub txt 電子書 下載 2024
Python3麵嚮對象編程(第2版 影印版 英文版) [Python 3 object-oriented Programming Second Edition] epub pdf mobi txt 電子書 下載 2024