Skip to content

Commit bb86d1d

Browse files
itsvsJelleZijlstra
andauthored
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]>
1 parent a74892c commit bb86d1d

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
@@ -1517,7 +1517,8 @@ multiple fragments.
15171517
depends on whether *encoding* or *errors* is given, as follows.
15181518

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

0 commit comments

Comments
 (0)