封面
书名页
Python 3 Object Oriented Programming
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. Object-oriented Design
Object-oriented?
Objects and classes
Specifying attributes and behaviors
Hiding details and creating the public interface
Composition and inheritance
Case study
Exercises
Summary
Chapter 2. Objects in Python
Creating Python classes
Adding attributes
Making it do something
Initializing the object
Modules and packages
Who can access my data?
Case study
Exercises
Summary
Chapter 3. When Objects are Alike
Basic inheritance
Extending built-ins
Overriding and super
Multiple inheritance
Polymorphism
Case study
Exercises
Summary
Chapter 4. Expecting the Unexpected
Raising exceptions
Handling exceptions
Exception hierarchy
Exceptions aren't exceptional
Case study
Exercises
Summary
Chapter 5. When to Use Object-oriented Programming
Treat objects as objects
Using properties to add behavior to class data
Managing objects
Case study
Exercises
Summary
Chapter 6. Python Data Structures
Empty objects
Tuples and named tuples
Dictionaries
Lists
Sets
Extending built-ins
Case study
Exercises
Summary
Chapter 7. Python Object-oriented Shortcuts
Python built-in functions
Len
Reversed
Enumerate
Zip
Other functions
Comprehensions
Generators
An alternative to method overloading
Functions are objects too
Case study
Exercises
Summary
Chapter 8. Python Design Patterns I
Design patterns
Decorator pattern
Observer pattern
Strategy pattern
State pattern
Singleton pattern
Template pattern
Exercises
Summary
Chapter 9. Python Design Patterns II
Adapter pattern
Facade pattern
Flyweight pattern
Command pattern
Abstract factory pattern
Composite pattern
Exercises
Summary
Chapter 10. Files and Strings
Strings
String manipulation
String formatting
Strings are Unicode
Mutable byte strings
File IO
Storing objects
Exercises
Summary
Chapter 11. Testing Object-oriented Programs
Why test?
Test-driven development
Unit testing
Testing with py.test
How much testing is enough?
Case Study
Exercises
Summary
Chapter 12. Common Python 3 Libraries
Database access
Pretty user interfaces
XML
CherryPy
Exercises
Summary
Index
更新时间:2021-08-03 15:36:25