try:
    L1 = sorted(L)
except TypeError:
    pass
else:
    return all(len(list(g)) == 1 for k, g in itertools.groupby(L1))
What's the most pythonic way to ensure that all elements of a list are different?