catching erros and exiting
- by apple pie
In python, is there a way to exit a class after testing a condition, without exiting out of python?
say i have the class
class test():
     def __init__(self):
         self.a = 2
     def create_b(self):
         self.b = 3
     def does_b_exist(self):
         if <self.b doesnt exist>:
             #terminate
         self.b += 1
try/except` doesnt work since the rest of the program doesnt terminate after failing. im basically trying to catch an error, and do what python does when it shows you errors, but i cant figure out how to do it