Fluent Python 2e 示例代码仓库,包含全书 24 章代码、Lisp 解释器修改版、测试脚本等。

章节目录

部分章节
I – Data StructuresPython Data Model、Sequences、Dictionaries、Unicode、Data Classes、Object References
II – FunctionsFirst-Class Functions、Type Hints、Decorators、Design Patterns
III – OOPPythonic Object、Sequences、Interfaces、Inheritance、Type Hints、Operator Overloading
IV – Control FlowIterators、with/match、Concurrency、Executors、Async
V – MetaprogrammingDynamic Attributes、Descriptors、Class Metaprogramming

测试

# Doctests
python3 -m doctest frenchdeck.doctest -v
 
# Jupyter Notebook
pip install pytest nbval
pytest --nbval

Win 同步

git add . && git commit -m "sync" && git push

Norvig Lisp 解释器修改

  • original/:原始 lis.py、lispy.py
  • py3.10/:适配 Python 3.10,添加类型提示和模式匹配

关键修改:

  • Procedure 类支持多表达式 body
  • lambda 使用 *body 解包
  • 移除 global_env 全局变量