Мне было интересно, можете ли вы добавить attibute в словарь python.
class myclass():
def __init__():
self.mydict = {} #initialize a regular dict
self.mydict.newattribute = "A description of what this dictionary will hold"
>>>AttributeError: 'dict' object has no attribute 'newattribute'
setattr(self.mydict,"attribute","A description of what this dictionary will hold"
>>>AttributeError: 'dict' object has no attribute 'newattribute'
В любом случае можно быстро добавить атрибут описания без необходимости копировать класс dict и перегружать конструктор. Я думал, что это будет просто, но я думаю, я был неправ.
Спасибо, J