animation nodes sorting object list by XYZ
I think you almost got it. I initially started designing loop subprograms but the sorted method and the expression nodes are your friends.
Remember you can chain expression nodes. Add an input of type &quot;Object List&quot;
The 3 expression nodes you should write are like so :

The 3 lines of code:
sorted(objs,key=lambda obj:obj.location[0])
sorted(objs,key=lambda obj:obj.location[1])
sorted(objs,key=lambda obj:obj.location[2])

To visualize it, create a loop subprogram to change the viewport color of the object depending on their order in the new, sorted list.

Add the subprogram at the end of your expression nodes :

Result :

Additionally, as a stand-alone python script :
import bpy

objs = bpy.data.objects; # Replace by relevant objects or collection
for axis in (0, 1, 2):
    objs = sorted(objs, key=lambda obj: obj.location[axis])

objs_len = len(objs)
for i, obj in enumerate(objs):
    fac = i / objs_len
    obj.color = (fac, 1 - fac, 0, 1)

Edit after comment asking for another way to sort the list (right to left, back to front, bottom to top)
You just have to add a slice operator at the end of the 2 first expression nodes to reverse the list : [::-1] See this doc for example (example 2)
So the expressions become :
sorted(objs,key=lambda obj:obj.location[0])[::-1]
sorted(objs,key=lambda obj:obj.location[1])[::-1]
sorted(objs,key=lambda obj:obj.location[2])

Result :