[issue13360] UnicodeWarning raised on sequence and set comparisons

Martin v. Löwis report at bugs.python.org
Sun Nov 6 23:46:38 CET 2011


Martin v. Löwis <martin at v.loewis.de> added the comment:

> Often sequences or sets have heterogeneous keys, mixing <str> and
> <unicode>, and in this case there's no easy way to work with them
> without raising this UnicodeWarning.

That's a bug in the application. You must not mix byte strings
and unicode strings as dictionary keys. Whether or not the warning
is produced: the behavior would still be fairly unpredictable, and
vary with Python versions.

> Of course it is only a warning, not a strong annoyance.

This warning is deliberate. It tells the developer that something
is broken about this application.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13360>
_______________________________________


More information about the Python-bugs-list mailing list