rxn.utilities.containers.iterate_unique_values
- rxn.utilities.containers.iterate_unique_values(seq, key=None)[source]
Remove duplicates and preserve order.
Adapted from https://stackoverflow.com/a/480227.
remove_duplicates
is identical except that it returns a list.- Parameters
seq (
Iterable
[TypeVar
(T
)]) – sequence to remove duplicates from.key (
Optional
[Callable
[[TypeVar
(T
)],TypeVar
(V
)]], default:None
) – what to base duplicates on, must be hashable. Defaults to the elements of seq.
- Yields
the original values after removal of the duplicates
- Return type
Iterator
[TypeVar
(T
)]