Brett Cannon added the comment:

Unfortunately it's impossible to warn against this in Python 2 since the bytes 
type is just another name for the str type:

>>> str == bytes
True
>>> type(b'1')
<type 'str'>

What we could potentially do, though, is change things such that -3 does what 
you are after when comparing bytes/str to unicode in Python 2. Unfortunately in 
that instance it's still a murky question as to whether that will help things 
more than hurt them as some people explicitly leave strings as-is in both 
Python 2 and Python 3 for either speed or code simplicity reasons.

----------
nosy: +brett.cannon
title: python2 -3 does not warn about str to bytes conversions and comparisons 
-> python2 -3 does not warn about str/unicode to bytes conversions and 
comparisons

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21401>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to