@@ -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
934934Note that numeric literals do not include a sign; a phrase like ``-1 `` is
@@ -965,7 +965,7 @@ stored in available memory::
965965
966966Underscores can be used to group digits for enhanced readability,
967967and 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:
974974Underscores can only occur between digits.
975975For 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.
979979Hexadecimal digits 10 through 15 are represented by letters ``A ``-``F ``,
980980case-insensitive. For example::
@@ -988,7 +988,6 @@ case-insensitive. For example::
988988
989989Underscores can occur between digits or after the base specifier, but not
990990within it.
991-
992991For example, ``0x_1f `` is a valid literal, but ``0_x1f `` is not.
993992
994993Note 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