Re: The best way to check if two lists have identical values

2010-02-25 Thread mk
On 2010-02-25 14:55, Arnaud Delobelle wrote: Your code checks if the two lists have the same length and the same elements, but not necessarily the same number of each elements. E.g. qips = [1, 1, 2] oldqips = [1, 2, 2] will return True If you want to check if each value has the same

Re: The best way to check if two lists have identical values

2010-02-25 Thread Daniel Stutzbach
On Thu, Feb 25, 2010 at 7:30 AM, mk wrote: > There's a number of complications here, depending on definition of 'lists > with identical values', like whether the same value can be repeated > different number of times in two lists, or whether the order of values > matters. > Order and repetitions

Re: The best way to check if two lists have identical values

2010-02-25 Thread Arnaud Delobelle
mk wrote: > Hello everyone, > > I have stumbled upon this seemingly trivial problem: the answer is not > there in http://www.python.org/doc/faq/programming/, and googling does > not return many references really (at least for me). > > I have come up with this: > > def qips_identical(q, oldq): >

Re: The best way to check if two lists have identical values

2010-02-25 Thread Peter Otten
mk wrote: > I have stumbled upon this seemingly trivial problem: the answer is not > there in http://www.python.org/doc/faq/programming/, and googling does > not return many references really (at least for me). > > I have come up with this: > > def qips_identical(q, oldq): > qips = map(ope

The best way to check if two lists have identical values

2010-02-25 Thread mk
Hello everyone, I have stumbled upon this seemingly trivial problem: the answer is not there in http://www.python.org/doc/faq/programming/, and googling does not return many references really (at least for me). I have come up with this: def qips_identical(q, oldq): qips = map(operator.it