Re: how to discover what values produced an exception?

Liste des GroupesRevenir à cl python 
Sujet : Re: how to discover what values produced an exception?
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.python
Date : 04. May 2024, 21: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

Date Sujet#  Auteur
3 May 24 * how to discover what values produced an exception?12Johanne Fairchild
3 May 24 +* Re: how to discover what values produced an exception?4Stefan Ram
4 May 24 i`* Re: how to discover what values produced an exception?3Stefan Ram
4 May 24 i +- Re: how to discover what values produced an exception?1Stefan Ram
4 May 24 i `- Re: how to discover what values produced an exception?1Stefan Ram
3 May 24 +* Re: how to discover what values produced an exception?3Thomas Passin
4 May 24 i`* Re: how to discover what values produced an exception?2Alan Bawden
6 May 24 i `- Re: how to discover what values produced an exception?1Chris Angelico
4 May 24 +- Re: how to discover what values produced an exception?1dieter.maurer
4 May 24 +- Re: how to discover what values produced an exception?12QdxY4RzWzUUiLuE
4 May 24 +- Re: how to discover what values produced an exception?1Stefan Ram
3 May 24 `- Re: how to discover what values produced an exception?1Left Right

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal