I've found this question rather helpful in the past, but this time I need to sort some objects in a list by the sum of some of their attributes.
Specifically, I have a list of objects each with a dimensions atttribute on 3 axes (eg: obj.dimensions.x)
I know you can sort a list by one attribute with:
list.sort(key=lambda obj: obj.dimensions.x)
But how could I sort it by the sum of the dimensions of each object's three axes such that an object with dimensions 3,3,3 would come before an object with 5,1,1 (greater sum)?