class Test: def __init__(self, val) -> None: self.val = val def p(self): print(self.val) print(type(self.val)) print(str(self.val)) print(f"Hello from {self.val}") t = Test(val=None) t.p() class TestTwo: def __init__(self, val) -> None: if not isinstance(val, int): raise OSError self.val = val def p(self): print(self.val) print(type(self.val)) t_two = TestTwo(val=True) t_two.p()