0

When using a PriorityQueue to add (priority, object) pairs, if the priority of a new object is equal to that of an existing one, the put() operation will fail with a TypeError: '<' is not implemented for objects of type <objtype>, ie, it is trying to sort objects of equal priority by the object itself, and failing when the comparator is not assigned. How can I avoid this issue, in the case where I don't actually care about order if priority is equal?

KBriggs
  • 1,220
  • 2
  • 18
  • 43
  • 1
    I think you need to add a code example that illustrates the error. – Jim Mischel Apr 10 '20 at 14:37
  • I deleted this because it ended up being a duplicate that I missed. The answer is here: https://stackoverflow.com/a/54028394/2521423 – KBriggs Apr 11 '20 at 15:03
  • 1
    Does this answer your question? [Using queue.PriorityQueue, not caring about comparisons](https://stackoverflow.com/questions/54027861/using-queue-priorityqueue-not-caring-about-comparisons) – KBriggs Apr 12 '20 at 16:36

0 Answers0