[docs] Possible typo in docs
Senthil Kumaran
senthil at uthcode.com
Thu Apr 7 23:40:17 EDT 2016
Hello Andrew,
You are right. The task should not be pop'ed out of the entry_finder
dictionary. I prefer the 2nd approach over the 1st one where the task is
re-added back to the dictionary.
def remove_task(task):
'Mark an existing task as REMOVED. Raise KeyError if not found.'
entry_finder[task][-1] = REMOVED
I will correct it in the docs.
--
Senthil
On Wed, Apr 6, 2016 at 3:42 AM, Andrew McFarland <
andrew.mcfarland at outlook.com> wrote:
> page in question: https://docs.python.org/2/library/heapq.html
>
> section: * 8.4.2. Priority Queue Implementation Notes*
>
> Currently:
>
>
> def remove_task(task):
> 'Mark an existing task as REMOVED. Raise KeyError if not found.'
> entry = entry_finder.pop(task)
> entry[-1] = REMOVED
>
>
> As it stands, 'task' is removed from dictionary 'entry_finder' and never
> replaced which is not the intention in my opinion.
>
> Possible fixes:
>
> 1.
> def remove_task(task):
> 'Mark an existing task as REMOVED. Raise KeyError if not found.'
> entry = entry_finder.pop(task)
> entry[-1] = REMOVED
> entry_finder[task] = entry
>
>
> 2.
> def remove_task(task):
> 'Mark an existing task as REMOVED. Raise KeyError if not found.'
> entry_finder[task][-1] = REMOVED
>
>
> Sincerely,
> AM
>
>
>
>
> _______________________________________________
> docs mailing list
> docs at python.org
> https://mail.python.org/mailman/listinfo/docs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20160407/845798af/attachment.html>
More information about the docs
mailing list