Marc 'BlackJack' Rintsch wrote:

> Because you are trying to compare a unicode string `val` with a byte
> string in the list. The unicode string will be converted to a byte string
> for this comparison with the default encoding: ASCII.

:-)

I presume you must live north of the equator. Down under, it seems to
happen the other way up -- the byte strings are decoded to unicode:

| >>> ['a', 'exotic1\xff', 'exotic2\xf3'].index(u'\xf3')
| Traceback (most recent call last):
|   File "<stdin>", line 1, in ?
| UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position
7: ordinal not in range(128)

(-:

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to