diff options
author | Vanshaj Singhania <8797467+itsvs@users.noreply.github.com> | 2022-04-05 02:34:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-05 02:34:28 (GMT) |
commit | bb86d1d9fbd1888524e04475383f4ea764277f67 (patch) | |
tree | 6c24bd668d4f97e20d906897b61f02328a403897 | |
parent | a74892cb2168d249d9a8c53fad605a5def9b41d4 (diff) | |
download | cpython-bb86d1d9fbd1888524e04475383f4ea764277f67.zip cpython-bb86d1d9fbd1888524e04475383f4ea764277f67.tar.gz cpython-bb86d1d9fbd1888524e04475383f4ea764277f67.tar.bz2 |
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 <jelle.zijlstra@gmail.com>
-rw-r--r-- | Doc/library/stdtypes.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index cdc4dad..6608b7b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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 |