Skip to content

Commit f9d7d12

Browse files
committed
Fix-ups
1 parent 06fa577 commit f9d7d12

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Doc/reference/lexical_analysis.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -922,13 +922,13 @@ Numeric literals
922922
floating-point literal, hexadecimal literal
923923
octal literal, binary literal, decimal literal, imaginary literal, complex literal
924924

925-
:token:`NUMBER` tokens represent numeric literals, of which there are three
926-
types: integers, floating-point numbers, and imaginary numbers.
925+
:data:`~token.NUMBER` tokens represent numeric literals, of which there are
926+
three types: integers, floating-point numbers, and imaginary numbers.
927927

928928
.. grammar-snippet::
929929
:group: python-grammar
930930

931-
NUMBER: integer | floatnumber | imagnumber
931+
NUMBER: `integer` | `floatnumber` | `imagnumber`
932932

933933

934934
Note that numeric literals do not include a sign; a phrase like ``-1`` is
@@ -965,7 +965,7 @@ stored in available memory::
965965

966966
Underscores can be used to group digits for enhanced readability,
967967
and are ignored for determining the numeric value of the literal.
968-
For example, the following literals are equivalent:
968+
For example, the following literals are equivalent::
969969

970970
100_000_000_000
971971
100000000000
@@ -974,7 +974,7 @@ For example, the following literals are equivalent:
974974
Underscores can only occur between digits.
975975
For example, ``_123``, ``321_``, and ``123__321`` are *not* valid literals.
976976

977-
Integers can be specified in binary (base 2), octal (base 2), or hexadecimal
977+
Integers can be specified in binary (base 2), octal (base 8), or hexadecimal
978978
(base 16) using the prefixes ``0b``, ``0o`` and ``0x``, respectively.
979979
Hexadecimal digits 10 through 15 are represented by letters ``A``-``F``,
980980
case-insensitive. For example::
@@ -988,7 +988,6 @@ case-insensitive. For example::
988988

989989
Underscores can occur between digits or after the base specifier, but not
990990
within it.
991-
992991
For example, ``0x_1f`` is a valid literal, but ``0_x1f`` is not.
993992

994993
Note that leading zeros in a non-zero decimal number are not allowed.
@@ -1001,8 +1000,7 @@ Formally, integer literals are described by the following lexical definitions:
10011000
.. grammar-snippet::
10021001
:group: python-grammar
10031002

1004-
integer: `decinteger` | `bininteger` | `octinteger` |
1005-
`hexinteger` | `zerointeger`
1003+
integer: `decinteger` | `bininteger` | `octinteger` | `hexinteger` | `zerointeger`
10061004
decinteger: `nonzerodigit` (["_"] `digit`)*
10071005
bininteger: "0" ("b" | "B") (["_"] `bindigit`)+
10081006
octinteger: "0" ("o" | "O") (["_"] `octdigit`)+

0 commit comments

Comments
 (0)