Luciano Ramalho 所著的 《流畅的python, 第二版》的示例代码(O'Reilly, 2022)。
所有章节都正在进行审查和更新,包括对第五部分中有关并发的章节进行了重大重写。
New chapters in Fluent Python 2e are marked with 🆕.
流畅的python-2e中新的章节已被标记为🆕。
🚨 在本书交付印刷之前,本目录可能随时更改。
最新更改: 旧版的 Part I—Prologue 已合并到新版 Part I—Data Structures; 部分相应地重新编号; 章节编号不变。
| Part / Chapter # | Title | Directory | 1st ed. Chapter # |
|---|---|---|---|
| I – 数据结构/Data Structures | |||
| 1 | python数据模型/The Python Data Model | 01-data-model | 1 |
| 2 | 基于序列的数组/An Array of Sequences | 02-array-seq | 2 |
| 3 | 字典和集合/Dictionaries and Sets | 03-dict-set | 3 |
| 4 | Unicode 文本和字节/Unicode Text versus Bytes | 04-text-byte | 4 |
| 5 | 数据类构建器/Data Class Builders | 05-data-classes | 🆕 |
| 6 | 对象引用、可变性和回收/Object References, Mutability, and Recycling | 06-obj-ref | 8 |
| II – 函数作为对象/Functions as Objects | |||
| 7 | 函数作为第一类对象/Funcions as First-Class Objects | 07-1class-func | 5 |
| 8 | 函数中的类型注解/Type Hints in Functions | 08-def-type-hints | 🆕 |
| 9 | 装饰器和闭包/Decorators and Closures | 09-closure-deco | 7 |
| 10 | 基于第一类函数的设计模式/Design Patterns with First-Class Functions | 10-dp-1class-func | 6 |
| III – 面向对象的风格/Object-Oriented Idioms | |||
| 11 | Pythonic 对象/A Pythonic Object | 11-pythonic-obj | 9 |
| 12 | 序列的特别方法/Special Methods for Sequences | 12-seq-hacking | 10 |
| 13 | 接口,协议,抽象/Interfaces, Protocols, and ABCs | 13-protocl-abc | 11 |
| 14 | 继承:无论好坏/Inheritance: For Better or For Worse | 14-inheritance | 12 |
| 15 | 更多关于类型注解/More About Type Hints | 15-more-types | 🆕 |
| 16 | 运算符重载/Operator Overloading | 16-op-overloading | 13 |
| IV – 控制流/Control Flow | |||
| 17 | 迭代器、生成器和经典协程/Iterators, Generators, and Classic Coroutines | 17-it-generator | 14 |
| 18 | with、match 和 else 块/with, match, and else Blocks | 18-with-match | 15 |
| 19 | Python 中的并发模型/Concurrency Models in Python | 19-concurrency | 🆕 |
| 20 | 并发执行器/Concurrent Executors | 20-executors | 17 |
| 21 | 异步编程/Asynchronous Programming | 21-async | 18 |
| V – 元编程/Metaprogramming | |||
| 22 | 动态特征和属性/Dynamic Attributes and Properties | 22-dyn-attr-prop | 19 |
| 23 | 属性描述符/Attribute Descriptors | 23-descriptor | 20 |
| 24 | 类元编程/Class Metaprogramming | 24-class-metaprog | 21 |