multiattrdict: make multilevel nesting work properly
This commit is contained in:
parent
eec67312b5
commit
0d58d32ad5
1 changed files with 5 additions and 1 deletions
|
@ -58,7 +58,7 @@ class multiattrdict(attrdict):
|
|||
try:
|
||||
return super(multiattrdict, self).__getattr__(attr)
|
||||
except AttributeError:
|
||||
d = optiondict()
|
||||
d = multiattrdict()
|
||||
setattr(self, attr, d)
|
||||
return d
|
||||
|
||||
|
@ -86,8 +86,12 @@ if __name__ == '__main__':
|
|||
print dir(x)
|
||||
print(x)
|
||||
|
||||
print
|
||||
print "multiattrdict"
|
||||
x = multiattrdict()
|
||||
x.x.x.x = 9
|
||||
x.y.z = 9
|
||||
print x
|
||||
print x.y
|
||||
print x.y.z
|
||||
print x.z.z
|
||||
|
|
Loading…
Reference in a new issue