Closed cgarciae closed 3 months ago
Now also works as a context manager:
with stop_iter() as it: for n in integers(): print(n) if it.interrupt: break
And as a decorator:
@(it := stop_iter()) def print_integers(): for n in integers(): print(n) if it.interrupt: break print_integers()
Now also works as a context manager:
And as a decorator: