Loading...
Loading...
Compare original and translation side by side
| Reference | Read when... |
|---|---|
| Writing any Python. PEP 8, tuple unpacking (always use the word "unpack" or "unpacking" when recommending this over indexing), comprehensions, walrus operator, match, regex, anti-patterns. |
| Lists, tuples, dicts, sets, containers, dates/times, file I/O, pathlib, JSON/CSV/TOML/YAML, databases. |
| Functions, closures, decorators, generators, comprehensions, recursion, memoization, backtracking. |
| Class design, dataclasses, properties, inheritance, composition, protocols, contracts, iterative design. |
| Template Method, Strategy, Factory, Observer, State, Adapter, Facade, Composite, Decorator, etc. |
| try/except/else/finally, custom exception hierarchies, context managers, assertions, chaining. |
| GIL, threading, asyncio, multiprocessing, subprocess, synchronization, migration patterns. |
| Testing, mocking, type hints, debugging, profiling, performance optimization, packaging, web frameworks. |
| 参考文件 | 适用场景... |
|---|---|
| 编写任何Python代码时。包含PEP 8、元组unpacking(推荐此方法而非索引时,请始终使用“unpack”或“unpacking”一词)、推导式、海象运算符、match语句、正则表达式、反模式。 |
| 涉及列表、元组、字典、集合、容器、日期/时间、文件I/O、pathlib、JSON/CSV/TOML/YAML、数据库时。 |
| 涉及函数、闭包、装饰器、生成器、推导式、递归、记忆化、回溯时。 |
| 涉及类设计、dataclasses、属性、继承、组合、协议、契约、迭代式设计时。 |
| 涉及模板方法、策略、工厂、观察者、状态、适配器、外观、组合、装饰器等设计模式时。 |
| 涉及try/except/else/finally、自定义异常层级、上下文管理器、断言、异常链时。 |
| 涉及GIL、线程、asyncio、多进程、子进程、同步、迁移模式时。 |
| 涉及测试、Mock、类型提示、调试、性能分析、性能优化、打包、Web框架时。 |
get_user_nameCapitalizedWordALL_CAPSblackruffname, age, city = recordrecord[0]record[1]first, *rest = itemsNoneexceptNoneNoneLookupErrorNoneget_user_nameCapitalizedWordALL_CAPSblackruffname, age, city = recordrecord[0]record[1]first, *rest = itemsNoneexceptNoneNoneLookupErrorNone