[docs] [issue13538] Docstring of str() and/or behavior
Antoine Pitrou
report at bugs.python.org
Tue Dec 6 16:00:19 CET 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
Well, I forgot to mention it in my previous message, but there is already a warning that you can activate with the -b option:
$ ./python -b
Python 3.3.0a0 (default:6b6c79eba944, Dec 6 2011, 11:11:32)
[GCC 4.5.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b"")
__main__:1: BytesWarning: str() on a bytes instance
"b''"
And you can even turn it into an error with -bb:
$ ./python -bb
Python 3.3.0a0 (default:6b6c79eba944, Dec 6 2011, 11:11:32)
[GCC 4.5.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b"")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
BytesWarning: str() on a bytes instance
However, -b is highly unlikely to become the default, for the reasons already explained. It was mainly meant to ease porting from Python 2.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13538>
_______________________________________
More information about the docs
mailing list