Serhiy Storchaka wrote:
> 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.

Yeah, I suppose not. But that does raise of question of why bytes objects
were made to have a specific form of string representation in the first
place, instead of the generic object address repr. I suspect that it might
be for historical or arbitrary reasons.

But, that's likely an entirely different topic. I'll leave it at that so I
don't derail the main topic.

Serhiy Storchaka wrote:
> 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.

Huh, interesting.



On Mon, Dec 16, 2019 at 3:59 AM Serhiy Storchaka <storch...@gmail.com>
wrote:

> 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/
>
_______________________________________________
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/Y4EPTAME4QRLLBGQBSH6YYADBYGPMLMV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to