Ale*_*ell 5 python inheritance attributes
我是python的新手,并试图获取对象类继承的类的列表.我正在尝试使用该bases属性执行此操作,但我没有取得任何成功.有人可以帮帮我吗?
def foo(C):
print(list(C.__bases__))
class Thing(object):
def f(self):
print("Yo")
class Shape(Thing):
def l(self):
print("ain't no thang")
class Circle(Shape):
def n(self):
print("ain't no shape")
test = Circle()
foo(test)
Run Code Online (Sandbox Code Playgroud)