checkifchange
This commit is contained in:
parent
8078b4ab7c
commit
f01bad40a2
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user