The documentation for the Queue.PriorityQueue class in Python is shown here:
https://docs.python.org/2/library/queue.html#Queue.PriorityQueue
It says, "A typical pattern for entries is a tuple in the form: (priority_number, data)"
However, when I try to input basic data into a Priority Queue, I get:
from Queue import PriorityQueue
pq = PriorityQueue()
pq.put(1, "one")
pq.put(2, "two")
pq.put(3, "three")
pq.get()
1
pq.get()
2
pq.get()
3
Isn't the first value in pq.put() the priority, and the second value is the data? It seems like this is reversed. Then when I try to input (data, priority), I get:
from Queue import PriorityQueue
pq = PriorityQueue()
pq.put("two", 4)
pq.put("one", 2)
pq.put("three", 6)
pq.get()
'one'
pq.get()
'three'
pq.get()
'two'
This not in correct order, because it should output, "one, two, three" Any thoughts?