bugfix
This commit is contained in:
parent
ec56a07a8b
commit
a721f00a68
@ -25,7 +25,8 @@ class DictObject(dict):
|
||||
实现点操作符访问字典中的键值对
|
||||
"""
|
||||
try:
|
||||
return self.__DOitem(self[attr])
|
||||
v = self.__DOitem(self[attr])
|
||||
self[attr] = v
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
@ -53,8 +54,9 @@ class DictObject(dict):
|
||||
|
||||
def __getitem__(self, key):
|
||||
try:
|
||||
v = super().__getitem__(key)
|
||||
return self.__DOitem(v)
|
||||
v = self.__DOitem(super().__getitem__(key))
|
||||
self[key] = v
|
||||
return v
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
@ -65,8 +67,11 @@ class DictObject(dict):
|
||||
self[attr] = value
|
||||
|
||||
def get(self, k, defv=None):
|
||||
v = super().get(k, defv)
|
||||
return self.__DOitem(v)
|
||||
try:
|
||||
v = self.__getitem__(k)
|
||||
return v
|
||||
except:
|
||||
return defv
|
||||
|
||||
def copy(self):
|
||||
return self.__DOitem(super().copy())
|
||||
|
Loading…
Reference in New Issue
Block a user