Thanks to visit codestin.com
Credit goes to github.com

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
Prev Previous commit
Merge remote-tracking branch 'upstream/main' into remove-deprecated-t…
…runc-delegation
  • Loading branch information
mdickinson committed Jun 2, 2024
commit 4a479abc44b9fbd88f9151e06943a2d22c63d65d
27 changes: 23 additions & 4 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -983,10 +983,29 @@ are always available. They are listed here in alphabetical order.
.. class:: int(number=0, /)
int(string, /, base=10)

Return an integer object constructed from a number or string *x*, or return
``0`` if no arguments are given. If *x* defines :meth:`~object.__int__`,
``int(x)`` returns ``x.__int__()``. If *x* defines :meth:`~object.__index__`,
it returns ``x.__index__()``.
Return an integer object constructed from a number or a string, or return
``0`` if no arguments are given.

Examples:

.. doctest::

>>> int(123.45)
123
>>> int('123')
123
>>> int(' -12_345\n')
-12345
>>> int('FACE', 16)
64206
>>> int('0xface', 0)
64206
>>> int('01110011', base=2)
115

If the argument defines :meth:`~object.__int__`,
``int(x)`` returns ``x.__int__()``. If the argument defines
:meth:`~object.__index__`, it returns ``x.__index__()``.
For floating point numbers, this truncates towards zero.

If the argument is not a number or if *base* is given, then it must be a string,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.