Skip to content

gh-150626: Update Format String Syntax documentation#153143

Open
pyctrl wants to merge 1 commit into
python:mainfrom
pyctrl:actualize-format-string-syntax-docs
Open

gh-150626: Update Format String Syntax documentation#153143
pyctrl wants to merge 1 commit into
python:mainfrom
pyctrl:actualize-format-string-syntax-docs

Conversation

@pyctrl

@pyctrl pyctrl commented Jul 5, 2026

Copy link
Copy Markdown

This PR is a replacement for the original PR #132736 that I have accidentally ruined. 😬

Related Issue: #150626

Original PR description.


Hello, let me try to help a bit with docs.

Here is an string formatting example:

In [29]: "{a-b} {-}".format(**{"-": "_-_", "a-b": "ABC"})
Out[29]: 'ABC _-_'

This behaviour differs from Format String Syntax:

arg_name: [identifier | digit+]
attribute_name: identifier

So I updated arg_name and attribute_name syntax in that section to follow the actual behaviour:

  • replaced identifier with attribute_name in arg_name
  • set syntax for attribute_name as anything that doesn’t contain "." or "]"

You can find original discussion thread here

Co-authored-by: Robsdedude <dev@rouvenbauer.de>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33449296 | 📁 Comparing 3a590e8 against main (28a8c18)

  🔍 Preview build  

1 file changed
± library/string.html

@pyctrl

pyctrl commented Jul 5, 2026

Copy link
Copy Markdown
Author

@robsdedude @skirpichev @encukou @ZeroIntensity

Could you please make a review of this PR? 🙏

If I can or should do something more here — please tell me and I will. (And I will be 200% careful this time)


ℹ️ FYI: Same changes for the target file with original PR branch.

(actualize-format-string-syntax-docs)$ git diff fix-docs-to-match-actual-behavior -- Doc/library/string.rst | wc -l
0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant