[docs] Possible typo in docs
Senthil Kumaran
senthil at uthcode.com
Fri Apr 8 00:59:49 EDT 2016
Replying again.
The docs as it stands is correct. The entry_finder is merely used as
pointer to the lastest task and the task itself is not removed from the
heapq.
Removing the task using entry_pop.() would not be affecting this as it is
anyways overridden in line 6 in the add_task.
So, no change is needed here.
Thank you,
Senthil
On Thu, Apr 7, 2016 at 8:40 PM, Senthil Kumaran <senthil at uthcode.com> wrote:
> 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/db54d753/attachment.html>
More information about the docs
mailing list