35 def __init__(self):
36 """Constructor"""
37 if self._default:
38 for key in self._default.__dict__.keys(): 39 self.__dict__[key] = copy.copy(self._default.__dict__[key])
40 return
41
Consider iterating the dictionary directly instead of calling .keys()
.
Using for key in dictionary
would always iterate the dictionary keys.
sounds = {"cow": "moo", "dog": "bark"}
for key in sounds.keys():
print(key)
sounds = {"cow": "moo", "dog": "bark"}
for key in sounds:
print(key)