exception arg

Mirko Nasato mn at altern.org
Tue Jan 4 12:38:59 EST 2000


I can't understand the following:

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


-- Mirko Nasato




More information about the Python-list mailing list