test for list equality

Miki Tebeka miki.tebeka at gmail.com
Thu Dec 15 12:59:33 EST 2011


> 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)



More information about the Python-list mailing list