In the Python docs,
The lowest valued entries are retrieved first (the lowest valued entry is the one returned by
sorted(list(entries))). A typical pattern for entries is a tuple in the form:
It appears the queue will be sorted by priority then data, which may not be always correct. Suppose data "item 2", is enqueued before "item 1", item 1 will still go first. In another docs page, heapq, it suggests the use of a counter. So I will store my data like
entry = [priority, count, task]. Isn't there something like
Then I won't need to implement the ordering myself?