Commit 1d678f84 authored by Georg Brandl's avatar Georg Brandl

Fix bug in heapq priority queue example.

parent 73dd7c71
...@@ -191,8 +191,8 @@ entry as invalid and optionally add a new entry with the revised priority:: ...@@ -191,8 +191,8 @@ entry as invalid and optionally add a new entry with the revised priority::
def get_top_priority(): def get_top_priority():
while True: while True:
priority, count, task = heappop(pq) priority, count, task = heappop(pq)
del task_finder[task]
if count is not INVALID: if count is not INVALID:
del task_finder[task]
return task return task
def delete_task(task): def delete_task(task):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment