I\'d like to compare multiple objects and return True only if all objects are not equal among themselves. I tried using the code below, but it doesn\'t work. If
True
If the objects are all hashable, then you can see whether a frozenset of the sequence of objects has the same length as the sequence itself:
frozenset
def all_different(objs): return len(frozenset(objs)) == len(objs)
Example:
>>> all_different([3, 4, 5]) True >>> all_different([3, 4, 5, 3]) False