From f01bad40a2b529c272396d977de54c2044365d92 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 29 Nov 2019 11:34:44 +0800 Subject: [PATCH] checkifchange --- appPublic/registerfunction.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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()