Python基础 · 免费预览
函数进阶
编写能接受灵活参数的函数,避开可变默认值的陷阱,并用闭包和装饰器包装其他函数。
1. Overview
Overview
2. Flexible Arguments
Flexible Arguments
3. The Mutable Default Trap
The Mutable Default Trap
4. Lambda and Sorting Keys
Lambda and Sorting Keys
5. Closures
Closures
6. Decorators
Decorators
7. Flexible Logger
Flexible Logger
8. A Counting Decorator
A Counting Decorator