Message148922
| Author |
pitrou |
| Recipients |
Guillaume.Bouchard, docs@python, pitrou, r.david.murray |
| Date |
2011年12月06日.15:00:18 |
| SpamBayes Score |
7.837267e-10 |
| Marked as misclassified |
No |
| Message-id |
<1323183619.04.0.429338748952.issue13538@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|