Skip to content

Commit f502dad

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 3fa800d commit f502dad

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

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

0 commit comments

Comments
 (0)