Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def f(method,timeout,condition=False,*args,**kwargs):
- t_end=time.time() +timeout
- while time.time()<t_end:
- ret=method(*args,**kwargs)
- if condition:
- return ret
- return ret
- def f2(a,b):
- print(a,b)
- def f3(a):
- print(a)
Add Comment
Please, Sign In to add comment