Strange behavior with sort()

ast nomail at invalid.com
Thu Feb 27 07:24:24 CET 2014


Hello

box is a list of 3 integer items

If I write:

    box.sort()
    if box == [1, 2, 3]:


the program works as expected. But if I write:

    if box.sort() == [1, 2, 3]:

it doesn't work, the test always fails. Why ?

Thx



More information about the Python-list mailing list