Documentation for "str()" could use some adjustment.

Terry Reedy tjreedy at udel.edu
Mon Mar 19 15:44:25 EDT 2007


"John Nagle" <nagle at animats.com> wrote in message 
news:XnqLh.10046$M65.6527 at newssvr21.news.prodigy.net...
| 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.

I agree.  Formulate a concise sentence and submit it as a doc patch on SF. 
No need for a separate file -- just put it in the report box along with the 
section where the change goes and an explanation and example of the 
exception raised.  If accepted, a doc maintainer will put it in the Latex 
source.

tjr






More information about the Python-list mailing list