iter_with_warning_error_context#

tpcp.misc.iter_with_warning_error_context(iterable: Iterable[T]) Iterator[tuple[Callable[[...], WarningErrorContext], T]][source]#

Pair every item with a warning/error context creator.

The creator has the same interface as warning_error_context, with the zero-based iteration index added as i. It does not infer any other context from the item. Enter it explicitly in the loop body so the context is closed before advancing or suspending the iterator.

Examples using tpcp.misc.iter_with_warning_error_context#

Warning and Error Context

Warning and Error Context