This is surely a duplicate, but say I have a class as follows:
class MyObj(object):
    def __init__(self, *args, **kwargs):
        self._data = [2, 1, 3]
        self._more_data = [False, True, False]
How can I make it sortable, not against other MyObj objects (which I could do with __lt__), but internally? So if I call sorted(my_obj_instance) I get a version with data like:
self._data = [1,2,3]
self._more_data [True, False, False]
That is, _data is sorted numerically, and _more_data has been sorted correspondingly.
 
     
     
     
    