[Twisted-Python] Unicode

glyph at divmod.com glyph at divmod.com
Tue Oct 4 09:11:30 MDT 2005



On Tue, 4 Oct 2005 07:40:29 -0700, Bob Ippolito <bob at redivi.com> wrote:

>What you mean is a code point > '\u007f', not '\u00ff'... but yeah, I  agree 
>with all this stuff.  Explicit is better than implicit, and str  -> unicode 
>implicit conversion is just wrong in almost all cases  (except when it's 
>knowable pure 7-bit ascii, like a constant or  symbol in your code).

I meant you couldn't do better than \u00ff, since I had previously mentioned the charmap codec:

>>> u'\u00ff'.encode('charmap')
'\xff'

but yes.  The main point is that implicit conversion cannot be made correct in any event.




More information about the Twisted-Python mailing list