Apr-16-2019, 08:03 PM
I'm apparently not being clear. I understand the simplistic example, the syntax, and how it works. What I am asking is what IF you have far more complicated code used to determine what your *single* value is to sort by. I am not asking for how to get 2+ sort values. I am asking how to refer to a function that determines one sort value which requires more than one argument.
I can only assume that you have to assign a variable to the return value of the function and then use the variable in the sorted statement.
sortKeyFunction(i, j, k): If i and j or not k: return [-1] else: return [0]I am not asking about multiple return values. The solution would be easy if the syntax allowed
print(sorted(strs, key=sortKeyFunction(True, True, False)))but it does not.
I can only assume that you have to assign a variable to the return value of the function and then use the variable in the sorted statement.