On Thu, Dec 15, 2011 at 11:30 PM, Alec Taylor <alec.tayl...@gmail.com> wrote: > Just for fun, use the Hungarian Algorithm > > (Python implementation: http://software.clapper.org/munkres/)
That's a pretty silly approach, but okay: def listequals(a, b): if len(a) != len(b): return False matrix = [[int(item_a != item_b) for item_b in b] for item_a in a] path = Munkres().compute(matrix) return sum(matrix[r][c] for (r, c) in path) == 0 -- http://mail.python.org/mailman/listinfo/python-list