Guest User

Untitled

a guest
May 20th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1.  
  2. def pop_task():
  3.     'Remove and return the lowest priority task. Raise KeyError if empty.'
  4.     while pq:
  5.         priority, count, task = heappop(pq)
  6.         if task is not REMOVED:
  7.             del entry_finder[task]
  8.             return task
  9.     raise KeyError('pop from an empty priority queue')
Add Comment
Please, Sign In to add comment