checkifchange

This commit is contained in:
yumoqing 2019-11-29 11:34:44 +08:00
parent 8078b4ab7c
commit f01bad40a2

View File

@ -13,3 +13,21 @@ class RegisterFunction:
def get(self,name): def get(self,name):
return self.registKW.get(name,None) 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()