Sujet : Re: how to discover what values produced an exception?
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 04. May 2024, 21:13:23
Autres entêtes
Organisation : Stefan Ram
Message-ID : <exceptions-20240504211223@ram.dialup.fu-berlin.de>
References : 1
Johanne Fairchild <
jfairchild@tudado.org> wrote or quoted:
We would know which were the values that caused the problem, which would
be very helpful.
So, why don't critical values get automatically printed out when
exceptions happen?
In Python, printing out a value usually means calling a method
like "__str__" or "__repr__". But the thing is, the exception
could have been raised inside that very method. If you then try
to automatically print out a critical value, that could trigger
more exceptions or other issues. Basically, you could end up
activating all sorts of random code, and the consequences of
that in that kind of situation are hard to predict