Skip to content
Merged
Changes from 1 commit
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
Next Next commit
gh-100428: Make float documentation more accurate
Previously, the grammar did not accept `float("10")`.
Also implement mdickinson's suggestion of removing the indirection.
  • Loading branch information
hauntsaninja committed Dec 22, 2022
commit 50807c3b99f3847a51a512745aa7ce35a6c719d7
11 changes: 8 additions & 3 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,16 @@ are always available. They are listed here in alphabetical order.
sign: "+" | "-"
infinity: "Infinity" | "inf"
nan: "nan"
numeric_value: `floatnumber` | `infinity` | `nan`

number: floatnumber [`exponent`]
Comment thread
hauntsaninja marked this conversation as resolved.
Outdated
floatnumber: [`digitpart`] "." `digitpart` | `digitpart` ["."]
digitpart: `digit` (["_"] `digit`)*
exponent: ("e" | "E") ["+" | "-"] `digitpart`

numeric_value: `number` | `infinity` | `nan`
numeric_string: [`sign`] `numeric_value`

Here ``floatnumber`` is the form of a Python floating-point literal,
described in :ref:`floating`. Case is not significant, so, for example,
Case is not significant, so, for example,
Comment thread
hauntsaninja marked this conversation as resolved.
Outdated
"inf", "Inf", "INFINITY", and "iNfINity" are all acceptable spellings for
positive infinity.

Expand Down