f-string docs update: the level of expression nesting in format specifiers
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
PEP 701 said:
Similarly, this PEP leaves up to the implementation the level of expression nesting in format specifiers but specifies a lower bound of 2 levels of nesting. This means that the following should always be valid:
f"{'':*^{1:{1}}}"
However, the docs haven't updated:
BTW, IIUC the specification of f-string has moved from syntax(lexical) to grammar.
Thus, it probably should be moved from https://docs.python.org/3.12/reference/lexical_analysis.html#formatted-string-literals to https://docs.python.org/3.12/reference/grammar.html or https://docs.python.org/3.12/reference/expressions.html#literals. Or a special note should be added.
At least this lexical grammar is outdated and should be removed (or replaced by the PEG grammar):
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,將 PEP 701 與 docs.python.org/3.12/reference/lexical_analysis.html 中關於格式化字串常值的章節,以及其中參照的文法和運算式章節進行比較。更新文件,說明支援的運算式巢狀層級,並釐清應刪除、取代過時的詞法文法,還是為其附加註記。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100