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, 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

Date Sujet#  Auteur
3 May 24 * Re: how to discover what values produced an exception?4Stefan Ram
4 May 24 `* Re: how to discover what values produced an exception?3Stefan Ram
4 May 24  +- Re: how to discover what values produced an exception?1Stefan Ram
4 May 24  `- Re: how to discover what values produced an exception?1Stefan Ram

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal