Skip to content

Content

1. Doing More with Python

  • Quick Note on The Book Edition
  • Python Versions
  • How To Use This Book

2. Scaling With Generators

  • Iteration in Python
  • Generator Functions
  • Generator Patterns and Scalable Composability
  • Python is Filled With Iterators
  • The Iterator Protocol

3. Creating Collections with Comprehensions

  • List Comprehensions
  • Formatting For Readability (And More)
  • Multiple Sources and Filters
  • Comprehensions and Generators
  • Dictionaries, Sets, and Tuples

4. Advanced Functions

  • Accepting & Passing Variable Arguments
  • Functions As Objects
  • Key Functions in Python

5. Decorators

  • The Basic Decorator
  • Data In Decorators
  • Decorators That Take Arguments
  • Class-based Decorators
  • Decorators For Classes
  • Preserving the Wrapped Function

6. Exceptions and Errors

  • The Basic Idea
  • Exceptions Are Objects
  • Raising Exceptions
  • Catching And Re-raising
  • The Most Diabolical Python Anti-Pattern

7. Classes and Objects: Beyond The Basics

  • Properties
  • The Factory Patterns
  • The Observer Pattern
  • Magic Methods
  • Rebelliously Misusing Magic Methods

8. Automated Testing and TDD

  • What is Test-Driven Development?
  • Unit Tests And Simple Assertions
  • Fixtures And Common Test Setup
  • Asserting Exceptions
  • Using Subtests
  • Final Thoughts

9. Logging in Python

  • The Basic Interface
  • Configuring The Basic Interface
  • Passing Arguments
  • Beyond Basic: Loggers
  • Log Destinations: Handlers and Streams
  • Logging to Multiple Destinations
  • Record Layout with Formatters

10. Python Virtual Environments

  • Creating New VEnvs
  • Python Package Management

拓展阅读