You ask two questions:
How to do this in Python?
class Bar(Foo):
data = Foo.data + "def"
Am I design wrong?
I usually do not use class variables in Python. A more typical paradigm is the initialization of an instance variable:
>>> class Foo(object):
... data = "abc"
...
>>> class Bar(Foo):
... def __init__(self):
... super(Bar, self).__init__()
... self.data += "def"
...
>>> b = Bar()
>>> b.data
'abcdef'
>>>
source
share