Loading...
Loading...
Compare original and translation side by side
NoneNonepolicy_cfg["precision"]policy_cfg["precision"]typing.NotRequiredNonetyping.NotRequiredNoneexamples/configs/*.yamlexamples/configs/recipes/**/*.yamlexamples/configs/*.yamlexamples/configs/recipes/**/*.yamlTypedDictexamples/configs/*.yamlTypedDictexamples/configs/*.yamldefaultsdefaultsexamples/configs/recipes/**/*.yamldefaults: <exemplar>.yamlexamples/configs/*.yamldefaultsuv run ./tools/config_cli.py minimize <recipe.yaml>defaultsexamples/configs/recipes/**/*.yamldefaults: <exemplar>.yamlexamples/configs/*.yamldefaultsuv run ./tools/config_cli.py minimize <recipe.yaml>defaultsNotRequiredin.get(key).get(key, None)NoneundefinedNotRequiredin.get(key).get(key, None)Noneundefined
**Don't:**
```python
**错误做法:**
```python
If a `NotRequired` field is absent, the code should handle that explicitly — not paper over it with a magic default.
如果`NotRequired`字段不存在,代码应显式处理——不要用魔法默认值掩盖问题。undefinedundefined
**Do:**
```python
**正确做法:**
```python
See also: @docs/design-docs/design-and-philosophy.md (TypedDict and Configuration Defaults section).
另请参阅:@docs/design-docs/design-and-philosophy.md (TypedDict和配置默认值部分)。