[issue41478] Empty representation of AssertionError

Ilya Kamenshchikov report at bugs.python.org
Thu Aug 6 14:26:24 EDT 2020


Ilya Kamenshchikov <ikamenshchikov at gmail.com> added the comment:

Changing behavior and it's impact on existing code is, without a doubt, a
big deal here. Maybe it's a reason not to do anything about it.

Just to understand guiding design principle, what is expected from __str__
in more general case? I thought about it as "user-friendly string
representation", therefore expected an Exception without a message to
identify itself by it's class.

Best Regards,
--
Ilya Kamen

On Thu, Aug 6, 2020 at 6:05 PM Rémi Lapeyre <report at bugs.python.org> wrote:

>
> Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:
>
> > That's a solution, except you must know ahead of time this issue exists.
>
> If we changed str(e) to make it the same as repr(e), there would be no way
> to get only the message. str(e) returns the message so if the message given
> was empty (or no message was given) you get an empty string. This cannot be
> changed without breaking a lot of code.
>
> ----------
> versions: +Python 3.10, Python 3.9
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <https://bugs.python.org/issue41478>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41478>
_______________________________________


More information about the Python-bugs-list mailing list