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

ezio.melotti at gmail.com ezio.melotti at gmail.com
Sat Nov 17 17:09:02 CET 2012


http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst
File Doc/library/functions.rst (right):

http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst#newcode1263
Doc/library/functions.rst:1263: If neither *encoding* nor *errors* is
given, ``str(object)`` returns
s/returns/calls/?

http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst#newcode1264
Doc/library/functions.rst:1264: :meth:`object.__str__`, which is the
"informal" representation of *object*.
Why not keeping the "nicely printable representation" used in the
original text?

http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst#newcode1264
Doc/library/functions.rst:1264: :meth:`object.__str__`, which is the
"informal" representation of *object*.
Doesn't it also fall back on __repr__ if __str__ is missing?

http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst#newcode1266
Doc/library/functions.rst:1266: function with related behavior.
"with related behavior" doesn't add much IMHO.
Either drop it and use "See also the repr function." or say what repr
does.

http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst#newcode1271
Doc/library/functions.rst:1271: :class:`bytes` (or :class:`bytearray`)
object in this case, then
s/in this case//?

http://bugs.python.org/review/13538/diff/6548/Doc/library/functions.rst#newcode1279
Doc/library/functions.rst:1279: or *errors* arguments uses the first
mode (see also the :option:`-b`
s/uses the first mode/calls b.__str__()/?

http://bugs.python.org/review/13538/diff/6548/Doc/reference/datamodel.rst
File Doc/reference/datamodel.rst (right):

http://bugs.python.org/review/13538/diff/6548/Doc/reference/datamodel.rst#newcode1168
Doc/reference/datamodel.rst:1168: Called by :func:`str(object) <str>`
and the built-in function :func:`print`
Should string formatting be mentioned too?

http://bugs.python.org/review/13538/diff/6548/Doc/reference/datamodel.rst#newcode1176
Doc/reference/datamodel.rst:1176: back to calling :meth:`__repr__`.
Where does this happen?  Is it done by str/print or it happens
automatically?

http://bugs.python.org/review/13538/diff/6548/Lib/test/test_unicode.py
File Lib/test/test_unicode.py (right):

http://bugs.python.org/review/13538/diff/6548/Lib/test/test_unicode.py#newcode1194
Lib/test/test_unicode.py:1194: self.assertEqual(str(b'foo',
errors="strict"), "foo")
A test with non-ascii (most likely utf-8) bytes should be added.

http://bugs.python.org/review/13538/


More information about the docs mailing list