The statement
raise Class, instance
is a shorthand for:
raise instance # shorthand for raise instance.__class__, instance
#!/usr/bin/env python
class B(object):
pass
class C(B):
pass
class D(C):
pass
for c in [B, C, D]:
try:
raise c()
except D:
print( "D")
except C:
print( "C")
except B:
print( "B")
print( " done ")
Note that the section 15.6.7 gives an example of how to catch exceptions in PyTango.