improved DataStorage to add key with the syntax a.data=3
This commit is contained in:
parent
1f652ab162
commit
69df940711
|
@ -119,6 +119,11 @@ class DataStorage(dict):
|
||||||
setattr(self,key,value)
|
setattr(self,key,value)
|
||||||
super().__setitem__(key, value)
|
super().__setitem__(key, value)
|
||||||
|
|
||||||
|
def __setattr__(self, key, value):
|
||||||
|
""" allows to add fields with data.test=4 """
|
||||||
|
super().__setitem__(key, value)
|
||||||
|
super().__setattr__(key,value)
|
||||||
|
|
||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
delattr(self,key)
|
delattr(self,key)
|
||||||
super().__delitem__(key)
|
super().__delitem__(key)
|
||||||
|
|
Loading…
Reference in New Issue