Abuse of the object-nature of functions?
Georg Brandl
g.brandl-nospam at gmx.net
Tue Jul 11 16:14:53 EDT 2006
Ant wrote:
>> Is there a way in python to say, "hey, catch everything but these two"?
>
>>>> try:
> ... raise AttributeError
> ... except Exception, ex:
> ... if isinstance(ex, AttributeError):
> ... print "Won't catch it!"
> ... raise ex
> ...
>
> Won't catch it!
> Traceback (most recent call last):
> File "<stdin>", line 7, in ?
> AttributeError
>
> Or that sort of thing.
To just reraise an exception, use a bare "raise".
Georg
More information about the Python-list
mailing list