2022-09-02 11:25:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Demo():
|
|
|
|
def __init__(self):
|
|
|
|
print("__init__")
|
|
|
|
self.funcs = []
|
|
|
|
self.funcs.append(self.a)
|
|
|
|
self.funcs.append(self.b)
|
2022-09-02 16:16:31 +00:00
|
|
|
self.funcs.append(self.c)
|
|
|
|
self.val = 'ppp'
|
2022-09-02 11:25:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
def a(self):
|
|
|
|
print('a')
|
|
|
|
|
|
|
|
def b(self):
|
|
|
|
print('b')
|
|
|
|
|
2022-09-02 16:16:31 +00:00
|
|
|
def c(self):
|
|
|
|
print(self.val)
|
|
|
|
|
2022-09-02 11:25:32 +00:00
|
|
|
def get_funcs(self):
|
|
|
|
return self.funcs
|
|
|
|
|
|
|
|
class Test():
|
|
|
|
def funcs_test(self):
|
|
|
|
demo = Demo()
|
|
|
|
funcs = demo.get_funcs()
|
|
|
|
print('----------------------------')
|
|
|
|
for func in funcs:
|
2022-09-02 16:16:31 +00:00
|
|
|
demo.func = func
|
|
|
|
demo.func()
|
2022-09-02 11:25:32 +00:00
|
|
|
|
|
|
|
test = Test()
|
|
|
|
test.funcs_test()
|
|
|
|
|