From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 5 Apr 2022 02:56:29 +0000 (-0700) Subject: bpo-47007: [doc] `str` special method lookup (GH-31863) X-Git-Tag: v3.10.5~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f502dadb332f911fa3b6c531bbc5065795cca242;p=thirdparty%2FPython%2Fcpython.git bpo-47007: [doc] `str` special method lookup (GH-31863) Clarify the `str()` docs to point out that `object.__str__()` follows special method lookup. Co-authored-by: Jelle Zijlstra (cherry picked from commit bb86d1d9fbd1888524e04475383f4ea764277f67) Co-authored-by: Vanshaj Singhania <8797467+itsvs@users.noreply.github.com> --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index b33033577310..28082b42d792 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1479,7 +1479,8 @@ multiple fragments. depends on whether *encoding* or *errors* is given, as follows. If neither *encoding* nor *errors* is given, ``str(object)`` returns - :meth:`object.__str__() `, which is the "informal" or nicely + :meth:`type(object).__str__(object) `, + which is the "informal" or nicely printable string representation of *object*. For string objects, this is the string itself. If *object* does not have a :meth:`~object.__str__` method, then :func:`str` falls back to returning