comparing Unicode and string
luc.saffre at gmail.com
luc.saffre at gmail.com
Thu Nov 9 20:02:57 EST 2006
Marc 'BlackJack' Rintsch wrote:
> Why? Python strings are *byte strings* and bytes have values in the range
> 0..255. Why would you restrict them to ASCII only?
Because getting an exception when comparing a string with a unicode
string is irritating.
But I don't insist on my PEP. The example just shows just another
pitfall with Unicode and why I'll advise to any beginner: Never write
text constants that contain non-ascii chars as simple strings, always
make them Unicode strings by prepending the "u".
Luc
More information about the Python-list
mailing list