loops is a Python 3 module which provides several utilities for asynchronously controlling loops.
This is loops version 1.2.1 (semver). The versioned API includes the functions timeout_single and timeout_total and the Loop class, as described in their docstrings.
- Python 3.2
- The
Loopclass is a cubclass ofthreading.Threadwhich allows looping over an iterable and stopping this loop externally without having to wait for the iterable to generate its next value. - The
timeout_totalfunction is a wrapper around an iterable which stops the iteration early if it takes longer than a given timeout. - Similarly, the
timeout_singlefunction is a wrapper around an iterable which stops the iteration early if any single value takes longer than a given timeout.