Documentation for "str()" could use some adjustment.
nagle at animats.com
Mon Mar 19 07:49:27 CET 2007
The Python documentation for "str" says
Return a string containing a nicely printable representation of an object."
However, there's no mention of the fact that "str" of a Unicode string
with non-ASCII characters will raise a conversion exception. The
documentation (and several Python books) seem to indicate that "str" will
produce some "printable representation" for anything, not raise an exception.
I know, it was proposed in PEP 349 to change "str" to return Unicode
strings, and that's coming someday, along with all-Unicode Python,
but meanwhile, the documentation should be clear about this.
More information about the Python-list