python / python/cpython

f-string docs update: the level of expression nesting in format specifiers

オープン
#124,608 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

docs
主要言語
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:
image
image

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):
image
image

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

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

はじめの一歩

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

調査の方向性

まず、PEP 701 と、docs.python.org/3.12/reference/lexical_analysis.html にあるフォーマット済み文字列リテラルのセクション、およびそこで参照されている文法と式のセクションを比較します。ドキュメントを更新して、サポートされる式のネストレベルを説明し、古くなった字句文法を削除、置き換え、または注記を添えるべきかを明確にします。

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

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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