exception arg

Fred L. Drake, Jr. fdrake at acm.org
Tue Jan 4 12:58:32 EST 2000


Mirko Nasato writes:
 > >>> 1/0
 > Traceback (innermost last):
 >   File "<stdin>", line 1, in ?
 > ZeroDivisionError: integer division or modulo
 > >>> try:
 > ...     1/0
 > ... except ZeroDivisionError, arg:
 > ...     if arg == "integer division or modulo":
 > ...             print "This is what I expect."
 > ...     else:
 > ...             print 'Unexpected. "arg" is "%s".' % arg
 > ... 
 > Unexpected. "arg" is "integer division or modulo".
 > >>>
 > 
 > The same seems to occur with every kind of exception, so maybe
 > there's an explanation...

  'arg' is a object for which the __str__ method returns "integer
division or modulo".


  -Fred

--
Fred L. Drake, Jr.	  <fdrake at acm.org>
Corporation for National Research Initiatives




More information about the Python-list mailing list