16.12.19 02:55, Kyle Stanley пише:
I'd much prefer to see something like this:
>>> str(b'\xc3\xa1')
...
TypeError: bytes argument without an encoding
Is there some use case for returning "b'\\xc3\\xa1'" from this operation
that I'm not seeing? To me, it seems equally, if not more confusing and
pointless than returning an empty string from str(errors='strict') or
some other combination of *errors* and *encoding* kwargs without passing
an object.
It is not more confusing that returning "<Foo object at 0x1234abcd>". By
default str() returns the same as repr(), unless we made the object
having other string representation.
You can get an error here if you run Python with -bb. This is a
temporary option to catch common errors of porting from Python 2.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/RRG4Q7BQWLIYNYNKJGE4BASFWTQ3P7PK/
Code of Conduct: http://python.org/psf/codeofconduct/