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, 20:08:26
Autres entêtes
Organisation : Stefan Ram
Message-ID : <stopgag-20240504200742@ram.dialup.fu-berlin.de>
References : 1 2 3
ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
def function( value ):
if value > 0:
return log( value )
else:
raise ZeroDivisionError( 'domain error' )
Otherwise, I reckon the stopgap solution for dealing with those
"features" would be something like this . . .
try:
function( value )
except ValueError:
print( 'value =', value )
raise