Sort with extra variables
Thomas Dybdahl Ahle
lobais at gmail.com
Fri Mar 2 14:29:24 EST 2007
I have a sort function in a python chess program.
Currently it looks like this:
def sortMoves (board, table, ply, moves):
f = lambda move: getMoveValue (board, table, ply, move)
moves.sort(key=f, reverse=True)
return moves
However I'd really like not to use the lambda, as it slows down the code.
I've thought about saving the extra variables in the global space, but it
really feals ugly.
Do you have any ideas how I can sort these moves the fastest?
More information about the Python-list
mailing list