pyfunctools.foreach module
- pyfunctools.foreach.forEach(arr: list, func)
Iterates over a list and calls a function for each item, passing the item itself and the index
- Parameters
arr (list) – List to iterate
func (function) – Callback function
Examples
>>> forEach([1, 2], lambda item, index: print(f'{item}, {index}')) 1, 0 2, 1