Skip to content

Commit c0063bd

Browse files
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 <[email protected]> (cherry picked from commit bb86d1d) Co-authored-by: Vanshaj Singhania <[email protected]>
1 parent e47e6ff commit c0063bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,8 @@ multiple fragments.
14481448
depends on whether *encoding* or *errors* is given, as follows.
14491449

14501450
If neither *encoding* nor *errors* is given, ``str(object)`` returns
1451-
:meth:`object.__str__() <object.__str__>`, which is the "informal" or nicely
1451+
:meth:`type(object).__str__(object) <object.__str__>`,
1452+
which is the "informal" or nicely
14521453
printable string representation of *object*. For string objects, this is
14531454
the string itself. If *object* does not have a :meth:`~object.__str__`
14541455
method, then :func:`str` falls back to returning

0 commit comments

Comments
 (0)