On 01/05/2013 04:55 PM, Terry Reedy wrote: > On 1/5/2013 1:58 PM, Dave Angel wrote: > >> If you're trying to make a faster loop, then I suggest you look into set >> differences. Turn both lists into sets, and subtract them. Something >> like (untested): >> >> result = not bool( set(lst1) - set(lst2) ) > > This does not return False as soon as an item in set1 is found that is > not in set2. > > set(lst1) < set(lst2) > > will, and directly return False/True. The OP is trying to compute the > lst1 < lst2, where lst1 and lst2 are interpreted as sets, rather than > as sequences with the lexicographic ordering default. >
Thanks. I wasn't aware that sets supported ordered comparison that way, though it makes perfect sense now that you point it out. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list