pyfunctools.map module

pyfunctools.map.map(arr: list, func) list

Function to create a new list based on callback function return

Parameters
  • arr (list) – a list to be iterated

  • func (function) – a callback function that will be executed every iteration and should return something for reduce assemble new list.

Examples

>>> map([1, 2, 3, 4], lambda item, index: item if item % 2 == 0 else None)
[2, 4]