We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
precision_with_grouping
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On this page: https://docs.python.org/3.14/library/string.html#grammar-token-format-spec-format_spec
format_spec: [options][width_and_precision][type] options: [[fill]align][sign]["z"]["#"]["0"] fill: <any character> align: "<" | ">" | "=" | "^" sign: "+" | "-" | " " width_and_precision: [width_with_grouping][precision_with_grouping] width_with_grouping: [width][grouping] precision_with_grouping: "." [precision][grouping] width: digit+ precision: digit+ grouping: "," | "_" type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
The precision_with_grouping syntaxe is wrong, because it accepts . without precision or grouping. But
.
precision
grouping
>>> f'{1234.1234:.f}' Traceback (most recent call last): File "<python-input-17>", line 1, in <module> f'{1234.1234:.f}' ^^^^^^^^^^^^^^ ValueError: Format specifier missing precision
(The error does not mention grouping either)
The right syntax should be
precision_with_grouping: "." precision [grouping] | "." grouping
The text was updated successfully, but these errors were encountered:
cc @skirpichev This is something we did right? I don't remember the issue/PR
Sorry, something went wrong.
Yes, it's not accurate, see #125304 (review). I forgot that, lets fix this.
@jonathanpoelen, would you like to propose a pr?
I'll let you do the pr :)
pythongh-134449: fix grammar for precision_with_grouping in format de…
ada07e7
…scription This amends f39a07b. Thanks to Jonathan Poelen.
PR is ready to review: #134608
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Documentation
On this page: https://docs.python.org/3.14/library/string.html#grammar-token-format-spec-format_spec
The
precision_with_grouping
syntaxe is wrong, because it accepts.
withoutprecision
orgrouping
. But(The error does not mention grouping either)
The right syntax should be
Linked PRs
The text was updated successfully, but these errors were encountered: