J
John Nagle
The Python documentation for "str" says
"str([object]) :
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.
John Nagle
"str([object]) :
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.
John Nagle