Traceback (most recent call last):(0,0) < 4
How to discover what values produced an exception?
|TypeError: '<' not supported between instances of 'tuple' and 'int'( 0, 0 )< 4
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---
Traceback (most recent call last):(0,0) < 4
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.
Sometimes you really need those values. If they're values of global
names, you can kind of get them in the IDLE shell up to a point.
raise ZeroDivisionError( 'domain error' )...
raise ZeroDivisionError( message )
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---
Traceback (most recent call last):(0,0) < 4
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.
def function( value ):
if value > 0:
return log( value )
else:
raise ZeroDivisionError( 'domain error' )
We would know which were the values that caused the problem, which would
be very helpful.
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---
Traceback (most recent call last):(0,0) < 4
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.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 446 |
Nodes: | 16 (2 / 14) |
Uptime: | 19:51:14 |
Calls: | 9,234 |
Calls today: | 1 |
Files: | 13,496 |
Messages: | 6,063,305 |