If you have a class hierarchy and some class attribute is overridden in child class then the user of child class should not care what was the value of this attribute in parent classes.
But this is what I want to achieve:
class A:
_ITEM = "A"
@classmethod
def getClassPath(cls):
???
class B(A):
_ITEM = "B"
class C(B):
_ITEM = "C"
# expected behavior:
A.getClassPath() # "/A"
B.getClassPath() # "/A/B"
C.getClassPath() # "/A/B/C"
My original problem is a little more complicated, but it is reduced to this: get _ITEM attributes from all the classes in hierarchy and combine them somehow.
How can I do it? There is no multiple inheritance in my case.