This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: modeule: queue class: PriorityQueue
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: asuiu, r.david.murray
Priority: normal Keywords:

Created on 2009-10-20 10:21 by asuiu, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg94270 - (view) Author: Andrew Shuiu (asuiu) Date: 2009-10-20 10:21
Puting 2 tuples like (100, data1), (100, data2) in a PriorityQueue
generates an builtins.TypeError: unorderable types: data1 < data2

Code which generates error:
theQueue.put((100, object1()),True)
theQueue.put((100, object1()),True)

Snippet from error:
builtins.TypeError: unorderable types: Crawler() < Crawler()
File "d:\work\python\gglcrwl.py", line 89, in <module>
  crawlGroup.Process()
File "d:\work\python\GglCrwLib.py", line 1056, in Process
  globs.linksQueue.put((globs.cDefLinkPriority,
Crawler(u.title_url,ca)),True)
File "C:\Program Files\Python31\Lib\queue.py", line 153, in put
  self._put(item)
File "C:\Program Files\Python31\Lib\queue.py", line 242, in _put
  heappush(self.queue, item)
msg94271 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-10-20 10:54
In python3 (unlike 2) objects are by default unorderable.  You'll need
to define an ordering for your objects in order to use them in a
PriorityQueue, whether or not they are inside a tuple.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51423
2009-10-20 10:54:08r.david.murraysetstatus: open -> closed
priority: normal
type: crash -> behavior


nosy: + r.david.murray
messages: + msg94271
resolution: not a bug
stage: resolved
2009-10-20 10:21:49asuiucreate