Add dotdict delattr.

master
voussoir 2022-11-07 17:57:19 -08:00
parent c838a9758a
commit 7618c46226
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,9 @@ class DotDict:
self.__dict__.update(__dict) self.__dict__.update(__dict)
self.__dict__.update(**kwargs) self.__dict__.update(**kwargs)
def __delattr__(self, key):
self.__dict__.pop(key, None)
def __getattr__(self, key): def __getattr__(self, key):
try: try:
return self.__dict__[key] return self.__dict__[key]