Document FrameLocalsProxy behaviour quirks
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Following PEP 667, https://docs.python.org/dev/reference/datamodel.html#frame-objects mentions that frame.f_locals may be a write-through proxy object, but doesn't really explain what that means.
Once https://github.com/python/peps/pull/3845 lands PEP 667 will contain such a description, but the main docs should at least cover the key behaviours:
- new instance on every attribute access
- two proxies with the same keys and values will still be unequal if they refer to different frames
- extra keys can be stored and are stored on the frame itself so they're shared across all proxies for the same frame
- keys corresponding to local variables can't be deleted
.copy()(and any other API that produces a new container) returns a regulardictinstance
Suggested location would be as a new 4th subsection under the frame objects section linked above. A "see also" from that new subsection back to PEP 667 would also be a useful addition.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Python 数据模型文档中的 frame 对象部分开始,并审阅 PEP 667,包括其中链接的 PEP pull request。添加第四个子小节,描述列出的 FrameLocalsProxy 的五种行为,并添加一个返回 PEP 667 的参见链接。完成的标准是主文档解释代理标识、共享的额外键、不可删除的局部变量以及生成字典的 API。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 88/100