Lets say I have something like this -
class A(object):
c = C()
class B(A):
pass
class C(object):
def __init__(self):
pass
def get_parent_class(self):
# This should return B
How would I implement get_parent_class, so that it will work as following -
B.c.get_parent_class() # Returns the class type B (not the instance b!)
Is this even possible?
I basically have a parent class (class A in our example), which contains a variable (var c in the example). I then have a child-class (class B which inherits A)
I want to use functions that C exposes on B, but in order to be used properly, I need C to know it's running on B
(Hope I didn't complicate things in the last explanation...)
Edit -
Please note that I'm not trying to get the class of C, that's an easy c.__class__. I need the class holding c
Thanks!