Is there a preferred general solution for testing equality of a list of lists. I'm attempting the apply this example more generally to a list of lists. I currently have the following solution, where _list
is a generic list of unknown length/number of elements.
all(x == y for x, y in zip(_list, _list[1:]))
or if the order doesn't matter.
all([sorted(x) == sorted(y) for x, y in zip(_list, _list[1:])])
Beyond checking neighbouring lists for equality, how can/should this approach my improved?