[issue41478] Empty representation of AssertionError

2020-12-16 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Since you should print the exception class anyway, I think that using repr 
should be sufficient and that this issue should be closed.  In any case, the 
current behavior does not seem like a bug.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Ilya, in the future, when responding by email, please delete the message you 
are responding to.  It is already present on the web page.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-06 Thread Ilya Kamenshchikov

Ilya Kamenshchikov  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  wrote:

>
> Rémi Lapeyre  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 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-06 Thread Rémi Lapeyre

Rémi Lapeyre  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-06 Thread Ilya Kamenshchikov

Ilya Kamenshchikov  added the comment:

That's a solution, except you must know ahead of time this issue exists.

Best Regards,
--
Ilya Kamen

On Tue, Aug 4, 2020 at 6:59 PM Rémi Lapeyre  wrote:

>
> Rémi Lapeyre  added the comment:
>
> Hi, can you not use its repr:
>
>
> >>> try: raise ValueError
> ... except Exception as e: print(f"Following happened: {e!r}")
> ...
> Following happened: ValueError()
>
> ?
>
> --
> nosy: +remi.lapeyre
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-04 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi, can you not use its repr:


>>> try: raise ValueError
... except Exception as e: print(f"Following happened: {e!r}")
...
Following happened: ValueError()

?

--
nosy: +remi.lapeyre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41478] Empty representation of AssertionError

2020-08-04 Thread Ilya Kamenshchikov


New submission from Ilya Kamenshchikov :

I have a high level wrapper where I am catching expection and present  it  in 
(more) user-friendly format with a message. 


try:
raise ValueError
except Exception as e:
print(f"Following happened: {e}")

>>> prints "Following happened: "

Can an exception print it's class when it has no message?

--
components: Interpreter Core
messages: 374831
nosy: Ilya Kamenshchikov
priority: normal
severity: normal
status: open
title: Empty representation of AssertionError
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com