On 8/10/06, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > I'd suggest that we still inform the programmers of the problem > by issuing a warning (which they can then silence at will), > maybe a new PyExc_UnicodeWarning.
Hmm... Here's an idea... How about we change unicode-vs-str __eq__ to issue a warning (and return False) instead of raising UnicodeException? That won't break much code (it's unlikely that people *depend* on this exception since it's generally a symptom of insane mixing of str and unicode). Then no further changes to dictobject.c are necessary (except fixing that one misleading comment). > Note that these exceptions help programmers making their applications > Unicode compatible, so silencing them completely would remove the > possibility to detect the case of mixing strings and Unicode as > keys in a dictionary. A warning would arguably have the same helping effect. (I suspect actually that we would have used warnings all along except we didn't have the warning framework when unicode was first introduced.) > BTW, in Py3k, this case would not trigger at all, since all text > would be Unicode and bytes wouldn't be comparable to Unicode > anyway. However, that's a different discussion which we can have > after Python 2.5 is out the door. Which is why I said I would have gladly waited until Py3k to fix this. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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