Sujet : Re: how to discover what values produced an exception?
De : list1 (at) *nospam* tompassin.net (Thomas Passin)
Groupes : comp.lang.pythonDate : 03. May 2024, 22:39:46
Autres entêtes
Message-ID : <mailman.4.1714772954.3326.python-list@python.org>
References : 1 2
User-Agent : Mozilla Thunderbird
On 5/3/2024 9:56 AM, Johanne Fairchild via Python-list wrote:
How to discover what values produced an exception? Or perhaps---why
doesn't the Python traceback show the values involved in the TypeError?
For instance:
--8<-------------------------------------------------------->8---
(0,0) < 4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'tuple' and 'int'
--8<-------------------------------------------------------->8---
It could have said something like:
--8<-------------------------------------------------------->8---
TypeError: '<' not supported between instances of 'tuple' and 'int'
in (0,0) < 4.
--8<-------------------------------------------------------->8---
We would know which were the values that caused the problem, which would
be very helpful.
In this example it would not help at all to know the actual values. Knowing that you are trying to compare incomparable types is enough.