first_unique

pydriosm.utils.first_unique(iterable)[source]

Return unique items in an input iterable variable given the same order of presence.

Parameters:

iterable (Iterable) – iterable variable

Returns:

unique items in the same order of presence as in the input

Return type:

Generator[list]

Examples:

>>> from pydriosm.utils import first_unique

>>> list_example1 = [1, 2, 2, 3, 4, 5, 6, 6, 2, 3, 1, 6]
>>> list(first_unique(list_example1))
[1, 2, 3, 4, 5, 6]

>>> list_example2 = [6, 1, 2, 2, 3, 4, 5, 6, 6, 2, 3, 1]
>>> list(first_unique(list_example2))
[6, 1, 2, 3, 4, 5]