Hi,
I understand that the default implementation of heapq.heapify is to create a min-heap. The logic for max-heapify has already been implemented inside _heapify_max and along with that for corresponding push and pop operations. But they are not exposed to the user and hence not mentioned in any of the docs. I am unable to find any explanation as to why this is so.
Current methods of implementing max-heaps (according to the SO question mentioned below) involves inverting the signs of numeric values and other workarounds. Therefore, I would like to propose officially supporting max-heaps as a part of heapq module.
SO Q&A regarding the issue : https://stackoverflow.com/questions/2501457/what-do-i-use-for-a-max-heap-implementation-in-python
Thank you
--
Abhai Kollara
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/E33N242KUHP33NITOSJ7JLRJMC74SQKY/
Code of Conduct: http://python.org/psf/codeofconduct/