Python has many tools for iteration, such as map and filter, that change an iterator into another iterator without consuming the iterator. These make it simple to deal with many items in a list without consuming excessive memory. Occasionally it is useful to be able to tap into iterator items and execute a function (such as a side effect to validate elements or print them) without making any changes to the overall iterator. This is similar to the idea of a tap in rxjs: https://rxjs-dev.firebaseapp.com/api/operators/tap. The proposed interface would be: def generate_items() -> list[int]: some_iter = range(10) some_iter = tap(assert_int, some_iter) some_iter = tap(print, some_iter) return list(some_iter) This would be useful to (for example): 1. Debug chained iterators without a debugger (at the moment you would have to convert the list and then print the whole list or include a print statement in one of the chained functions) 2. Check that items in an iterator conform to assumptions and raising exceptions if they do not 3. Improve type hints in editors since after the assert is executed all items conform to the assert in the tap (for example, they are an integer) The implementation would be quite simple (at least in python): def tap(func: typing.Callable[[T], typing.Any], iter: typing.Iterable[T]) -> typing.iterable[T]: for item in iter: func(item) yield item Thoughts?