I have a list of objects like below:
my_list = [LowPriorty(), HighPriority(), HighestPriority(), MediumPriority(), HighestPriority()]
These objects will have a custom defined order, e.g. I could define the order of highest priority to lowest priority like below:
HighestPriority() = should be closest to start of list
HighPriority() = should be second closest to start of the list
MiddlePriority() = should be third closest to start of the list
LowPriority() = should be fourth closest to start of the list
LowestPriority() = should be closest to end of the list
I want to re-order the list based on the priority structure I setup above, so I would expect the sorted list to look like below:
sorted_my_list = [HighestPriority(), HighestPriority(), HighPriority(), MediumPriority(), LowPriority()]
What is the best way to do this? The ordering is going to be based on the class type, but I need to be able to define which class is higher priority.