Skip to content
Open
Changes from 2 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 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
infinity: "Infinity" | "Inf"
nan: "NaN" [`digits`] | "sNaN" [`digits`]
numericvalue: `decimalpart` [`exponentpart`] | `infinity`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do Sphinx production lists support numeric-value instead or should it be without any weird symbol? if not, use _ instead of - to separate words.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx does not support -, but it does support _.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet another thing I should perhaps add to my list of things to fix upstream... Thanks for checking.

numericstring: [`sign`] `numericvalue` | [`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