Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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, as well as underscores throughout, are removed:

.. productionlist:: decimal
sign: "+" | "-"
digit: "0"..."9"
indicator: "e" | "E"
digits: (`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`

Other Unicode decimal digits are also permitted where ``digit``
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand Down
Loading