This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add function to exploit heapq structure to locate an index of element
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: SamUnimelb, rhettinger, stutzbach
Priority: normal Keywords:

Created on 2020-11-10 03:36 by SamUnimelb, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23204 SamUnimelb, 2020-11-10 03:36
Repositories containing patches
https://github.com/python/cpython/blob/3.8/Lib/heapq.py
Messages (4)
msg380628 - (view) Author: Sam Yan (SamUnimelb) * Date: 2020-11-10 03:36
Github PR #23204:
For a given element in a heap, we can leverage the fact that we can
search this element quicker thinking of the property of a heap. Therefore
out of h.index(x) that a list linear search uses, I propose to use a special written index method to look for an index of a heap element.This issue has been proposed on Github (with my changes to heapq also put there). Open a discussion under suggestion of Karthikeyan Singaravelan (tirkarthi).
msg380629 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-11-10 04:37
What is the use case for this?

This doesn't seem to be a typical heap operation.  https://en.wikipedia.org/wiki/Heap_(data_structure)#Operations

Have you seen the in other heap APIs?
msg380630 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-11-10 04:42
See: https://stackoverflow.com/questions/2372994/search-an-element-in-a-heap
msg380736 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-11-11 07:11
Marking this as declined for the reasons listed in the PR comments.
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86467
2020-11-11 07:11:08rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg380736

stage: resolved
2020-11-10 04:42:54rhettingersetmessages: + msg380630
2020-11-10 04:37:20rhettingersettitle: Lack function to track index of an element in heapq -> Add function to exploit heapq structure to locate an index of element
messages: + msg380629
components: + Library (Lib), - Extension Modules
versions: - Python 3.6, Python 3.7, Python 3.8, Python 3.9
2020-11-10 04:12:55xtreaksetnosy: + rhettinger, stutzbach
2020-11-10 03:36:08SamUnimelbcreate