> Well, you'd have to define the function inside the sortMoves function, as 
> it is where the variables exists.
> 
> def sortMoves(board, table, ply, moves):
>     def sortKey(move):
>         return getMoveValue(board, table, ply, move)
>     moves.sort(key=sortKey, reverse=True) return moves
> 
> Wouldn't that make it create the callable at each call?

Yes, it does. But it's only created _once_ per sortMoves-call, and 
afterwards doesn't affect performance.

And no, it's not slower than you lambda version - they _should_ be 
equally fast, if not it's neglible. And also doesn't affect 
sorting-performance.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to