I need to wait in a script until a certain number of conditions become true?
I know I can roll my own eventing using condition variables and friends, but I don\'t wa
Proposed solution:
def wait_until(delegate, timeout: int): end = time.time() + timeout while time.time() < end: if delegate(): return True else: time.sleep(0.1) return False
Usage:
wait_until(lambda: True, 2)