diff --git a/appPublic/registerfunction.py b/appPublic/registerfunction.py index a69533b..9f32878 100644 --- a/appPublic/registerfunction.py +++ b/appPublic/registerfunction.py @@ -13,3 +13,21 @@ class RegisterFunction: def get(self,name): return self.registKW.get(name,None) + +if __name__ == '__main__': + def x(a): + print('x():a=',a) + + def y(a): + print('y():a=',a) + + def z(): + rf = RegisterFunction() + for name in ['func1', 'func2' ]: + f = rf.get(name) + print(name,f('hahah')) + + rf = RegisterFunction() + rf.register('func1',x) + rf.register('func2',y) + z()