all_distinct¶
- iteration_utilities.all_distinct(iterable, /)¶
Checks if all items in the iterable are distinct.
- Parameters:
- iterableiterable
Iterable containing the elements.
- Returns:
- distinct
bool
True
if no two values are equal andFalse
if there is at least one duplicate in iterable.
- distinct
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