Skip to content

Commit 5aafa54

Browse files
authored
bpo-40340: Separate examples more clearly in the programming FAQ (GH-19688)
1 parent 503de71 commit 5aafa54

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Doc/faq/programming.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,11 @@ For integers, use the built-in :func:`int` type constructor, e.g. ``int('144')
851851
e.g. ``float('144') == 144.0``.
852852

853853
By default, these interpret the number as decimal, so that ``int('0144') ==
854-
144`` and ``int('0x144')`` raises :exc:`ValueError`. ``int(string, base)`` takes
855-
the base to convert from as a second optional argument, so ``int('0x144', 16) ==
856-
324``. If the base is specified as 0, the number is interpreted using Python's
857-
rules: a leading '0o' indicates octal, and '0x' indicates a hex number.
854+
144`` holds true, and ``int('0x144')`` raises :exc:`ValueError`. ``int(string,
855+
base)`` takes the base to convert from as a second optional argument, so ``int(
856+
'0x144', 16) == 324``. If the base is specified as 0, the number is interpreted
857+
using Python's rules: a leading '0o' indicates octal, and '0x' indicates a hex
858+
number.
858859

859860
Do not use the built-in function :func:`eval` if all you need is to convert
860861
strings to numbers. :func:`eval` will be significantly slower and it presents a

0 commit comments

Comments
 (0)