1class HauntedMansion:
2 def __init__(self, **kwargs):
3 for key, value in kwargs.items():
4 setattr(self, key, value)
5
6 def __getattr__(self, name):
7 return "Booooo, only ghosts here!"
8
9 def __setattr__(self, name, value):
10 name = f"spooky_{name}"
11 super().__setattr__(name, value)
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK