John Nagle <[EMAIL PROTECTED]> wrote: ... > The real problem is the published books on Python: > > "Learning Python", by Lutz and Ascher: > "str(string) -- returns the string representation of any object." > > "Python in a Nutshell", by Martelli > Doesn't really address the issue, but says that "print" calls > "str" for conversions. > > Neither of these mentions that "str" is ASCII-only.
Are you looking at p. 109 of the 2nd edition of the Nutshell? That's where looking for str will eventually lead you. The word "ASCII" is nowhere in sight in this page (because it's only true if you don't change the default encoding, so saying "str is ASCII-only" would be a lie -- now THAT kind of disinformation WOULD be a "real problem" in a "published book on Python") but right after the documentation for __str__ you see that for __unicode__ which explains their respective roles (returning plain-string types and unicode strings respectively). Unicode is documented on page 198 ff, where you will clearly see that: """ Python uses a default encoding, normally 'ascii'. """ followed by pointers to modules and functions connected with changing that default, and a recommendation to avoid doing that and why. I therefore dispute your contention that "Python in a Nutshell" ``doesn't really address the issue", as well as your other contention that "the real problem is" my book (I won't speak for Lutz and Ascher). If you disagree, feel free to open an errata on O'Reilly's page devoted to my book (and/or to the one by Lutz and Ascher); I will of course do my best to strongly rebut your provably-false contentions, if it's my book you choose to attack (I use the word advisedly, because it's easy to see that you're not interested in offering constructive criticism and suggestions -- it would have been obvious to open an errata, had you been thus interested -- but only in picking a public fight about this). Alex -- http://mail.python.org/mailman/listinfo/python-list