I've made a lot of research on the net but I didn't find the correct way to extend "class" attributes dictionary with new values in a subclass. Most of the documentation are extending attributes inside methods.
I tried dictionary.update() but it doesn't work.
This is my example:
class Super(object):
dictionary = {'one':1, 'two':2}
def __init__(self, var):
self.var = var
def supermethod(self):
pass
And I extended it to:
class Subclass(Super):
dictionary.update({"zero":0})
def __init__(self, var):
super(Subclass, self).__init__(var)
self.var = var
def submethod(self):
pass
If I override dictionary - it works fine. But If I try to extend, it gives me:
AttributeError: 'Subclass' object has no attribute 'dictionary'