all_distinct

iteration_utilities.all_distinct(iterable, /)

Checks if all items in the iterable are distinct.

Parameters:

iterable : iterable

Iterable containing the elements.

Returns:

distinct : bool

True if no two values are equal and False if there is at least one duplicate in iterable.

Notes

The items in the iterable should implement equality.

If the items are hashable the function is much faster.

Examples

>>> from iteration_utilities import all_distinct
>>> all_distinct('AAAABBBCCDAABBB')
False
>>> all_distinct('abcd')
True