This commit is contained in:
2023-04-19 19:11:20 -04:00
parent 2c2adc4082
commit 1ef6c3cbf8
6 changed files with 134 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
from Simulation import Simulation
class Vault:
def __init__(self):
self._treasure = "gold"
self._attributes = dict(self.__dict__)
def __setattr__(self, name, value):
if name != "_attributes" and name not in self._attributes:
print("attribute deleted!")
self._attributes[name] = value
super().__setattr__("_attributes", dict(self.__dict__))
@property
def treasure(self):
if self.__dict__ != self._attributes:
print("attribute deleted!")
return self._treasure