-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-128185: Align the grammar of the Decimal string constructor with float's
#128315
New issue
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
5cbf217
f5468ad
b80f68f
9646cd5
f263f6d
1e13f7c
2cd8e6b
015abbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -350,18 +350,19 @@ Decimal objects | |
| *value* can be an integer, string, tuple, :class:`float`, or another :class:`Decimal` | ||
| object. If no *value* is given, returns ``Decimal('0')``. If *value* is a | ||
| string, it should conform to the decimal numeric string syntax after leading | ||
| and trailing whitespace characters, as well as underscores throughout, are removed:: | ||
|
|
||
| sign ::= '+' | '-' | ||
| digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ||
| indicator ::= 'e' | 'E' | ||
| digits ::= digit [digit]... | ||
| decimal-part ::= digits '.' [digits] | ['.'] digits | ||
| exponent-part ::= indicator [sign] digits | ||
| infinity ::= 'Infinity' | 'Inf' | ||
| nan ::= 'NaN' [digits] | 'sNaN' [digits] | ||
| numeric-value ::= decimal-part [exponent-part] | infinity | ||
| numeric-string ::= [sign] numeric-value | [sign] nan | ||
| and trailing whitespace characters are removed: | ||
|
|
||
| .. productionlist:: decimal | ||
| sign: "+" | "-" | ||
| digit: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | ||
| indicator: "e" | "E" | ||
| digits: (`digit` | "_")* `digit` (`digit` | "_")* | ||
| decimalpart: `digits` "." [`digits`] | ["."] `digits` | ||
| exponentpart: indicator [sign] digits | ||
HarryLHW marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| infinity: "Infinity" | "Inf" | ||
| nan: "NaN" [`digits`] | "sNaN" [`digits`] | ||
| numericvalue: `decimalpart` [`exponentpart`] | `infinity` | ||
|
||
| numericstring: [`sign`] `numericvalue` | [`sign`] `nan` | ||
|
|
||
| Other Unicode decimal digits are also permitted where ``digit`` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you can reference grammar term instead. Though, this may add a conflict with #128323, so - you can include that change here as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like this: Other Unicode decimal digits are also permitted where :token:`~decimal.digit` |
||
| appears above. These include decimal digits from various other | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.