更新时间:2021-08-03 15:36:25
封面
书名页
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?
Chapter 3. When Objects are Alike
Basic inheritance
Extending built-ins
Overriding and super
Multiple inheritance
Polymorphism
Chapter 4. Expecting the Unexpected
Raising exceptions
Handling exceptions
Exception hierarchy
Exceptions aren't exceptional
Chapter 5. When to Use Object-oriented Programming
Treat objects as objects
Using properties to add behavior to class data
Managing objects
Chapter 6. Python Data Structures
Empty objects
Tuples and named tuples
Dictionaries
Lists
Sets
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
Chapter 8. Python Design Patterns I
Design patterns
Decorator pattern
Observer pattern
Strategy pattern
State pattern
Singleton pattern
Template pattern
Chapter 9. Python Design Patterns II
Adapter pattern
Facade pattern
Flyweight pattern
Command pattern
Abstract factory pattern
Composite pattern
Chapter 10. Files and Strings