In Python, is the a simple way to test that all values in a list are equal to one another?
>>> a = [1, 1, 1, 1] >>> len(set(a)) 1
Note that this method assumes that each element in your list can be placed into a set. Some types, such as the mutable types, cannot be placed into a set.