Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def guarded(*guard_func):
- def decor(func_m1):
- def guard(*param):
- if guard_func[1](*param):
- guard.i=(guard.i+1) % 2
- if guard.i==0:
- return func_m1(*param)
- else:
- print("parametri non rispettati")
- guard.i=0
- return guard
- return decor
- @guarded(2, lambda x,y,z: (x+y)==z)
- def m1(x,y,z):
- print("sto eseguendo m1 con i valori {0}{1}{2}".format(x,y,z))
Add Comment
Please, Sign In to add comment