Is 0 > None??
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Tue Sep 4 13:12:48 EDT 2001
I really appreciate Alex' detailed exegesis of plain->Unicode string
conversion under different encodings. I had, confessedly, not properly
understood the nature of the sorting problem, nor the exact breadth of
the underlying issue.
Still, the solutions to the conversion limits seem somewhat awkward. I
can change my own 'site.py' or 'sitecustomize.py', but I cannot count on
it being changed on a user's machine (and it wouldn't be very good
manners to go mucking with it just to run my program). I guess the best
solution is to add something like:
def cleancoding(fleep, mycodec='latin-1'):
try: return unicode(fleep, mycodec)
except TypeError: return fleep
lst[:] = map(cleancoding, lst)
To all my old programs. But adding it everywhere necessary is a bit
cumbersome, and probably slows programs down a bit.
Moreover, it is not clear that forcing everything in lists into a
'latin-1' encoding is really semantically correct either. There is no
real harm in it; but if I am working with a binary format, 'chr(128)' is
quite likely simply to mean "the byte value of 128" rather than "capital
C with cedilla."
Yours, Lulu...
More information about the Python-list
mailing list