'20' <= 100

Grant Edwards grante at visi.com
Fri May 2 11:25:41 EDT 2003


In article <vb51tudgd51h64 at news.supernews.com>, John Roth wrote:

>> Isn't there also something about comparing two strings of
>> different encodings also raising an exception?
> 
> Hadn't heard that one, and I don't understand why it would do
> so. Unless I've missed something completely, strings don't
> carry encoding information with them. They're either unicode or
> single byte, and the latter can always be converted to the
> former for comparison purposes.

I probably didn't describe it accurately, but here it is:

>>> chr(140) < '1234'
0
>>> chr(140) < u'1234'
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: ASCII decoding error: ordinal not in range(128)

-- 
Grant Edwards                   grante             Yow!  I'm gliding over a
                                  at               NUCLEAR WASTE DUMP near
                               visi.com            ATLANTA, Georgia!!




More information about the Python-list mailing list