Author pitrou
Recipients kristjan.jonsson, pitrou, rhettinger
Date 2008-10-22.18:53:06
SpamBayes Score 5.71375e-06
Marked as misclassified No
Message-id <>
I haven't tried the patch as is but I can spot two problems:
- you should use PyList_CheckExact instead of PyList_Check, because a
list subclass could override __getitem__
- when keyfunc is not NULL, you can't assume that the list size will
stay constant; indeed, calling keyfunc may mutate the list (try
something like `max(l, key=l.pop)`)

I've got no opinion on whether the speedup is worth the added
complexity. Perhaps a way of simplifying the patch would be to enable
the special path only when keyfunc==NULL. Others may comment.
Date User Action Args
2008-10-22 18:53:09pitrousetrecipients: + pitrou, rhettinger, kristjan.jonsson
2008-10-22 18:53:09pitrousetmessageid: <>
2008-10-22 18:53:07pitroulinkissue4174 messages
2008-10-22 18:53:06pitroucreate