mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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>
(cherry picked from commit bb86d1d9fb
)
Co-authored-by: Vanshaj Singhania <8797467+itsvs@users.noreply.github.com>
This commit is contained in:
parent
3fa800d7a7
commit
f502dadb33
1 changed files with 2 additions and 1 deletions
|
@ -1479,7 +1479,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue