sandbox/none_val/playground.py
2024-11-02 14:14:15 +03:00

26 lines
488 B
Python

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()