Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort list by custom function

from functools import cmp_to_key
sorted(mylist, key=cmp_to_key(lambda item1, item2: fitness(item1) - fitness(item2)))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #sort #list #custom #function
ADD COMMENT
Topic
Name
3+7 =