In python 2, what is the easy way to sort a list, using "sorted" method, using a custom comparison function (for example, how to sort release_numbers = [1.2, 4.4.4, 1.2.1], using custom "compare" function that compares 1.2 to 1.2.1)?
Answer
sorted(release_numbers, cmp=compare)
^^ note the cmp arg is unique to python 2 and takes a custom compare function to use in sort.
Question
In python 2, what is the easy way to sort a list, using "sorted" method, using a custom comparison function (for example, how to sort release_numbers = [1.2, 4.4.4, 1.2.1], using custom "compare" function that compares 1.2 to 1.2.1)?
Answer
?
Question
In python 2, what is the easy way to sort a list, using "sorted" method, using a custom comparison function (for example, how to sort release_numbers = [1.2, 4.4.4, 1.2.1], using custom "compare" function that compares 1.2 to 1.2.1)?
Answer
sorted(release_numbers, cmp=compare)
^^ note the cmp arg is unique to python 2 and takes a custom compare function to use in sort.
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.