http://mail.python.org/pipermail/python-dev/2006-August/067934.html M.-A. Lemburg mal at egenix.com
> Ralf Schmitt wrote: >> Still trying to port our software. here's another thing I noticed: >> d = {} >> d[u'm\xe1s'] = 1 >> d['m\xe1s'] = 1 >> print d (a 2-element dictionary, because they are not equal) >> With python 2.5 I get: [ a traceback ending in ] >> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 1: >> ordinal not in range(128) > Let's put it this way: Python 2.5 uncovered a bug in your > application that has always been there. No; he application would only have a bug if he expected those two objects to compare equal. Trying to stick something hashable into a dictionary should not raise an Exception just because there is already a similar key, (regardless of whether or not the other key is equal or identical). The only way this error could be the right thing is if you were trying to suggest that he shouldn't mix unicode and bytestrings at all. There is a command line switch for that, but it doesn't get much use. -jJ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com