Sort with extra variables

Thomas Dybdahl Ahle lobais at gmail.com
Sat Mar 3 00:51:38 CET 2007


Den Fri, 02 Mar 2007 15:20:33 -0800 skrev MonkeeSage:

> On Mar 2, 5:11 pm, Thomas Dybdahl Ahle <lob... at gmail.com> wrote:
>> Wouldn't that be just as slow?
> 
> Well, I'm not sure about speed, but with the lambda you're creating a
> new callable for f every time you call sortMoves. Intuitively, that
> seems like it would be more of a hit than just doing a lookup for a
> predefined function. Mabye not though...you could time it and see.

I guess the thing is that I'd have to create a new callable no matter 
how, as it is the only way to bring the extra variables into the getValue 
function when called by sort.



More information about the Python-list mailing list