imap

Collocations.imap(*args, **kwargs)

Apply a function on files and return the result immediately

This method does exact the same as map() but works as a generator and is therefore less memory space consuming.

Parameters:
  • *args – The same positional arguments as for map().

  • **kwargs – The same keyword arguments as for map().

Yields:

A tuple with the FileInfo object of the processed file and the return value of the applied function. If output is set, the second element is not the return value but a boolean values indicating whether the return value was not None.