Can you tell me how to do this.
I have been using this
class Obj:
def __init__(self, a=0, b=1):
self.a = a
self.b = b
if name == “main”:
def getmykey(obj):
key = obj.b
return key
objects = [Obj(1, 2), Obj(5, 4), Obj(7, 3),Obj(11, 42), Obj(8, 0), Obj(5, 9)]
print(sorted( objects ,key=getmykey))