The result of .sort() is None, not the sorted object. The comparison was comparing the result of the .sort() method and not the sorted values.