[docs] Improve doc for str(bytesobject) (issue 13538)

chris.jerdonek at gmail.com chris.jerdonek at gmail.com
Sun Nov 18 03:00:46 CET 2012

File Doc/library/functions.rst (right):

Doc/library/functions.rst:1264: :meth:`object.__str__`, which is the
"informal" representation of *object*.
On 2012/11/17 22:37:49, cjerdonek wrote:
> On 2012/11/17 17:09:02, ezio.melotti wrote:
> > Doesn't it also fall back on __repr__ if __str__ is missing?
> str() (unicode_new() in the source code) only calls object.__str__()
> (PyObject_Str() in the source code):

What I wrote isn't quite correct.  str() calls PyObject_Str(), but
PyObject_Str() isn't called by object.__str__().  However,
object.__str__() (or at least the default implementation?) seems to
implement its own equivalent fallback logic:


So in distinct ways both code paths seem to contain this fallback logic.


More information about the docs mailing list