| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b7a68ab commit edfbf56
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -893,17 +893,21 @@ are always available. They are listed here in alphabetical order. | |||
| 893 | 893 | For floating point numbers, this truncates towards zero. | |
| 894 | 894 | ||
| 895 | 895 | If *x* is not a number or if *base* is given, then *x* must be a string, | |
| 896 | - :class:`bytes`, or :class:`bytearray` instance representing an :ref:`integer | ||
| 897 | - literal <integers>` in radix *base*. Optionally, the literal can be | ||
| 898 | - preceded by ``+`` or ``-`` (with no space in between) and surrounded by | ||
| 899 | - whitespace. A base-n literal consists of the digits 0 to n-1, with ``a`` | ||
| 900 | - to ``z`` (or ``A`` to ``Z``) having | ||
| 901 | - values 10 to 35. The default *base* is 10. The allowed values are 0 and 2--36. | ||
| 902 | - Base-2, -8, and -16 literals can be optionally prefixed with ``0b``/``0B``, | ||
| 903 | - ``0o``/``0O``, or ``0x``/``0X``, as with integer literals in code. Base 0 | ||
| 904 | - means to interpret exactly as a code literal, so that the actual base is 2, | ||
| 905 | - 8, 10, or 16, and so that ``int('010', 0)`` is not legal, while | ||
| 906 | - ``int('010')`` is, as well as ``int('010', 8)``. | ||
| 896 | + :class:`bytes`, or :class:`bytearray` instance representing an integer | ||
| 897 | + in radix *base*. Optionally, the string can be preceded by ``+`` or ``-`` | ||
| 898 | + (with no space in between), have leading zeros, be surrounded by whitespace, | ||
| 899 | + and have single underscores interspersed between digits. | ||
| 900 | + | ||
| 901 | + A base-n integer string contains digits, each representing a value from 0 to | ||
| 902 | + n-1. The values 0--9 can be represented by any Unicode decimal digit. The | ||
| 903 | + values 10--35 can be represented by ``a`` to ``z`` (or ``A`` to ``Z``). The | ||
| 904 | + default *base* is 10. The allowed bases are 0 and 2--36. Base-2, -8, and -16 | ||
| 905 | + strings can be optionally prefixed with ``0b``/``0B``, ``0o``/``0O``, or | ||
| 906 | + ``0x``/``0X``, as with integer literals in code. For base 0, the string is | ||
| 907 | + interpreted in a similar way to an :ref:`integer literal in code <integers>`, | ||
| 908 | + in that the actual base is 2, 8, 10, or 16 as determined by the prefix. Base | ||
| 909 | + 0 also disallows leading zeros: ``int('010', 0)`` is not legal, while | ||
| 910 | + ``int('010')`` and ``int('010', 8)`` are. | ||
| 907 | 911 | ||
| 908 | 912 | The integer type is described in :ref:`typesnumeric`. | |
| 909 | 913 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments