sknano.core.unique_elements

sknano.core.unique_elements(iterable, key=None)[source][source]

Return generator of unique elements in iterable, preserving order.

Examples

>>> list(unique_elements('AAAABBBCCDAABBB'))
['A', 'B', 'C', 'D']
>>> list(unique_elements('ABBCcAD'))
['A', 'B', 'C', 'c', 'D']
>>> list(unique_elements('ABBCcAD', str.lower))
['A', 'B', 'C', 'D']