Author hwundram
Recipients
Date 2006-05-20.16:15:57
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=791932

By the way, I've just become aware of the fact that this
patch changes the semantics of list.sort() somewhat, because
of an optimization I did to the code. The DSU-function isn't
called anymore when there are less than two items to sort,
i.e. the list or the slice to sort is one item long. This means:

---
def test(k):
    k.append(4)
    return k[0]
x = [[1,2,3]]
x.sort(key=test)
print x
---

will now print [[1,2,3]] (with the patch applied), whereas
Python 2.4 would've printed [[1,2,3,4]], but not have called
timsort either.

I don't know whether this breaks anything (or the old
behaviour was sensible); at least it should have to be
documented. I'd like feedback before I start either taking
out the optimization or documenting this.
History
Date User Action Args
2007-08-23 15:48:58adminlinkissue1491804 messages
2007-08-23 15:48:58admincreate