unique¶
- emlib.iterlib.unique(seq)[source]¶
Return only unique elements of a sequence (keeps order)
If seq is not an iterator or order is not important it is more efficient to call set instead. :rtype:
Iterator
[TypeVar
(T
)]Note
Elements must be hashable
>>> tuple(unique((1, 2, 3))) (1, 2, 3) >>> tuple(unique((1, 2, 1, 3))) (1, 2, 3)