Exceptions Can Be Classes : Error Exception : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » Error Exception »

 

Exceptions Can Be Classes


class B:
      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"



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Statement
» Error Exception