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` doesn't work since the rest of the program doesn't terminate after failing. I'm 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