Martin Panter added the comment:

A warning is already emitted if you enable it with the “-b” flag, which I 
recommend. You can even turn the warning into an error with “-bb”. And you can 
always use repr() or ascii() to inspect for a more robust inspection.

$ python3 -bb
Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print(b"\xFF")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BytesWarning: str() on a bytes instance
>>> print(repr(b"\xFF"))
b'\xff'

----------
nosy: +martin.panter

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

Reply via email to