[Gustavo Nare] > In other words: The more different elements two collections have, the > faster it is to compare them as sets. And as a consequence, the more > equivalent elements two collections have, the faster it is to compare > them as lists. > > Is this correct?
If two collections are equal, then comparing them as a set is always slower than comparing them as a list. Both have to call __eq__ for every element, but sets have to search for each element while lists can just iterate over consecutive pointers. If the two collections have unequal sizes, then both ways immediately return unequal. If the two collections are unequal but have the same size, then the comparison time is data dependent (when the first mismatch is found). Raymond -- http://mail.python.org/mailman/listinfo/python-list