test for list equality

Terry Reedy tjreedy at udel.edu
Thu Dec 15 20:02:05 EST 2011


On 12/15/2011 12:59 PM, Miki Tebeka wrote:
>> My sort issue... as in this doesn't work
>>>>> if x.sort == y.sort:
> You're missing the () to make it a function call.
> Also list.sort() returns none, it mutates the original list.
> You can either
>      sorted(x) == sorted(y)
> or
>      set(x) == set(y)

or x.sort(); y.sort(); x == y

-- 
Terry Jan Reedy




More information about the Python-list mailing list