I want to know if it is possible to do something like the following
class A:
a = 1
class B:
a = 2
class C(A):
pass
x = A.B.C()
print(x.a)
In this scenario I would want it to print 1
.
I have seen other posts on here trying to inherit from parent classes but I am trying to keep class B
from inheriting everything in the parent class. It is a matter of organization of the classes and it happens that for my needs it is more visually organized if I place the classes like this rather than creating non-nested classes. If more information is needed let me know.
I'm not really sure how to word it better so here is a better picture of what I am already working with.
class TopLevelClass:
class MidLevelClass:
someVar = 'SomeText'
class SiblingToMidLevel:
class Child1:
class Child2(MidLevelClass):
pass
Ultimately what I want to do is to be able to access the someVar
variable from the Child2
class.