Skip to content

Commit

Permalink
bpo-47007: [doc] str special method lookup (GH-31863)
Browse files Browse the repository at this point in the history
Clarify the `str()` docs to point out that `object.__str__()`
follows special method lookup.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
  • Loading branch information
itsvs and JelleZijlstra authored Apr 5, 2022
1 parent a74892c commit bb86d1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,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__() <object.__str__>`, which is the "informal" or nicely
:meth:`type(object).__str__(object) <object.__str__>`,
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
Expand Down

0 comments on commit bb86d1d

Please sign in to comment.