bpo-26701: Tweak the documentation for special methods in int(). (GH-6741)

(cherry picked from commit df00f04825)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-05-10 07:38:20 -07:00 committed by GitHub
parent 8ac158a6df
commit 7488c79b60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -657,8 +657,8 @@ are always available. They are listed here in alphabetical order.
.. function:: hex(x) .. function:: hex(x)
Convert an integer number to a lowercase hexadecimal string prefixed with Convert an integer number to a lowercase hexadecimal string prefixed with
"0x". If x is not a Python :class:`int` object, it has to define an "0x". If *x* is not a Python :class:`int` object, it has to define an
__index__() method that returns an integer. Some examples: :meth:`__index__` method that returns an integer. Some examples:
>>> hex(255) >>> hex(255)
'0xff' '0xff'
@ -716,12 +716,10 @@ are always available. They are listed here in alphabetical order.
int(x, base=10) int(x, base=10)
Return an integer object constructed from a number or string *x*, or return Return an integer object constructed from a number or string *x*, or return
``0`` if no arguments are given. If *x* is a number, return ``0`` if no arguments are given. If *x* defines :meth:`__int__`,
:meth:`x.__int__() <object.__int__>`. If *x* defines ``int(x)`` returns ``x.__int__()``. If *x* defines :meth:`__trunc__`,
:meth:`x.__trunc__() <object.__trunc__>` but not it returns ``x.__trunc__()``.
:meth:`x.__int__() <object.__int__>`, then return For floating point numbers, this truncates towards zero.
:meth:`x.__trunc__() <object.__trunc__>`. For floating point numbers,
this truncates towards zero.
If *x* is not a number or if *base* is given, then *x* must be a string, If *x* is not a number or if *base* is given, then *x* must be a string,
:class:`bytes`, or :class:`bytearray` instance representing an :ref:`integer :class:`bytes`, or :class:`bytearray` instance representing an :ref:`integer