On Tue, Apr 26, 2016 at 9:43 PM, Christopher Reimer <christopher_rei...@icloud.com> wrote: > class Test2(dict): > def __init__(self): > self.__dict__ = {'key', 'value'}
This class definition looks muddled. Because Test2 inherits from dict, the object referred to by "self" will be a dict, and self.__dict__ is actually a *different* dict, containing the attributes of self. The line: self.__dict__ = {'key', 'value'} is essentially equivalent to: self.key = value and will be regardless of whether you inherit from object or dict. If you find this distinction confusing, then I recommend not inheriting from dict. -- https://mail.python.org/mailman/listinfo/python-list