def remove(self, task):
"""
Removes the tasks from Queue
Currently it takes O(n) time to find , and O(log n) to remove, making it O(n)
further improvements can be done
:param task: task to removed from the Queue
"""
import heapq
for task_pair in self.heap:
if task_pair[2] == task:
self.heap.remove(task_pair)
heapq.heapify(self.heap)
评论列表
文章目录