Skip to content

Sync python-formatted-output with the updated tutorial - #838

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/python-formatted-output-20260916
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/python-formatted-output-20260916

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Syncs python-formatted-output/ with the maintenance update of A Guide to Modern Python String Formatting Tools.

What changed

format.py

  • Added the new Python 3.14 grouping-after-precision example the update introduces in The grouping Component section, right after the thousand-separator examples:

    print(f"{1.23456789:.8_f}")
    print("{0:.8_f}".format(1.23456789))
  • Renamed prec to precision in the dynamic-format-specifier examples, so the script matches the variable name the article's code blocks use. (Pre-existing drift, picked up while syncing the folder to the article's current state.)

interpolation.py (all pre-existing drift against the live article, fixed in the same pass)

  • The first commented-out pair now contrasts the f and F prefixes, which is what the article's first block demonstrates; it previously repeated the quote-style contrast of the block below it.
  • "First fruit in list is" / "Last two fruits in list are" now read "... in the list ...", matching the article's output.
  • The last line duplicated the preceding keyword-argument example. Replaced it with the examples the article actually shows next: keyword arguments in an arbitrary order, and positional plus keyword arguments passed as variables.

No requirements.txt change: the article's dependencies field is python==3.14 / minimum-python==3.6 with no third-party packages, and the folder ships nothing for a reader to install from. The python==3.12 -> python==3.14 bump in the article has no pin to mirror here.

person.py and README.md are unchanged; nothing in the update touched them.

How this was verified

  • Fresh venv on the article's new pin (uv venv --python 3.14 -> CPython 3.14.6), no third-party installs needed.
  • Every script executed under MPLBACKEND=Agg; all three exit 0 and their output matches the corresponding blocks in the updated draft, including the new 1.234_567_89 grouping output and the corrected 6 bananas cost $10.44 line.
  • Repo gates with the version the root requirements.txt pins:
    • uvx ruff@0.14.1 format --check python-formatted-output -> 3 files already formatted
    • uvx ruff@0.14.1 check python-formatted-output -> All checks passed!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant