multiattrdict: make multilevel nesting work properly

This commit is contained in:
Nathan Binkert 2009-09-22 15:24:16 -07:00
parent eec67312b5
commit 0d58d32ad5

View file

@ -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