[issue9636] {'key': 'value'}[b'key'] raises a BytesWarning

Antoine Pitrou report at bugs.python.org
Thu Aug 19 14:36:09 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

Well, that's what BytesWarning is for. I agree it is annoying in normal use, but it is meant to ease porting of 2.x code. That's why it is only enabled when you use the corresponding command-line switch.

The warning in the dict case is especially important: otherwise it is easy to get a dict with duplicate bytes and unicode keys (say b"xxx" and "xxx"), and potentially different values.

----------
nosy: +pitrou
resolution:  -> rejected
status: open -> closed

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


More information about the Python-bugs-list mailing list