I have a question about name clashes in python. If I have something like:
class A: a='a'
class B(A): a='b'
class C(A): a='c'
class D(C,B): pass
D.a
will print c
, is there any way to retrieve B.a
from D
or A.a
?
I have a question about name clashes in python. If I have something like:
class A: a='a'
class B(A): a='b'
class C(A): a='c'
class D(C,B): pass
D.a
will print c
, is there any way to retrieve B.a
from D
or A.a
?
Yes, you can do exactly what you suggest:
class D(C, B):a = A.a