A bug or a feature: how to avoid?

Lexy Zhitenev zhitenev at cs.vsu.ru
Tue Nov 26 11:12:51 EST 2002


My code has to react on many exceptions.
I use ActivePython 2.2.1 with stackless 2.2.2 DLL.

The problem is that I can't write a handler for more than two exceptions at
once. My program can throw a lot of exceptions, and I can't react on them
simultaneously!

This code doesn't work, it raises SyntaxError

>>> try:
...  pass
... except IndexError, ValueError, NameError:
Traceback (  File "<interactive input>", line 3
    except IndexError, ValueError, NameError:
                                 ^
SyntaxError: invalid syntax
>>>

I don't want to write the code under try statement twice! What's the
solution? Or it should be reported as a bug?





More information about the Python-list mailing list