Raising objects
Carlos P.
cpitaar at yahoo.com.ar
Tue Apr 29 11:50:42 EDT 2003
Hi all,
I have this short question: can the operator 'raise' raise exceptions
which are instances of object? I'm getting the following behaviour
from python 2.2.2:
>>> class F: pass
>>> raise F()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
__main__.F: <__main__.F instance at 0x8136bf4>
>>> class E(object): pass
>>> raise E()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: exceptions must be strings, classes, or instances, not E
Thank you,
Carlos
More information about the Python-list
mailing list