python / python/cpython

Document FrameLocalsProxy behaviour quirks

オープン 初心者向け
#125,731 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

3.13 3.14 docs triaged
主要言語
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 regular dict instance

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Python データモデルのドキュメントにある frame オブジェクトのセクションから始め、リンクされている PEP の pull request を含めて PEP 667 を確認します。FrameLocalsProxy の列挙された 5 つの動作を説明する 4 番目のサブセクションと、PEP 667 への See also リンクを追加します。メインドキュメントで、プロキシの同一性、共有される追加キー、削除できないローカル変数、dict を生成する API が説明されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
88/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。