I need to implement an event list in python, where each element is an event that has an associated timestamps. The actions that I need to perform are essentially two: inserting in the right order (decreasing timestamps), and retrieving the event with the smaller start time.
I am aware of the bisect module, but it doesn't allow to insert arbitrary items in the list. For this reason I think that maybe I could implement the event list with two different python data structures:
Inserting and retrieving are straightforward.
Do you think that there is a more efficient approach?
You can either go with heap queue, as @Bogdan suggests, or you can use sched for more advance purposes.