Skip to content

gh-110067: Make max heap methods public and add missing ones #130725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
May 5, 2025

Conversation

StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Mar 1, 2025

Made public, added test (same as normal heap) and added docs.

@rhettinger has not opened the planned PR in ~2 years


📚 Documentation preview 📚: https://cpython-previews--130725.org.readthedocs.build/

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are various things to change. I don't know why we should expose the Python implementation and not the C implementation which is faster.

@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@StanFromIreland
Copy link
Member Author

I was working on the C implementation, my bad!

@StanFromIreland
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2025

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from picnixz March 1, 2025 15:40
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would group _max with their non-max variants and update their descriptions since they are effictively different.

@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@picnixz picnixz marked this pull request as draft March 1, 2025 15:48
@picnixz
Copy link
Member

picnixz commented Mar 1, 2025

I'm converting into a draft until the comments are addressed. In addition, since we are now having code duplication for heappushpop_max and heappushpop, we could perhaps refactor the common logic (but maybe not in this PR yet)

StanFromIreland and others added 3 commits March 1, 2025 16:03
@StanFromIreland
Copy link
Member Author

StanFromIreland commented Mar 1, 2025

I have made the requested changes; please review again

We can leave de-duplication for later.

@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2025

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from picnixz March 1, 2025 16:11
@StanFromIreland StanFromIreland requested a review from encukou March 10, 2025 17:21
StanFromIreland and others added 2 commits March 17, 2025 16:05
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Copy link
Contributor

@ambv ambv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue your PR is solving is called "maxheap version of a heappush", but the PR is missing a C implementation of "heappush_max".

@StanFromIreland StanFromIreland requested a review from ambv May 2, 2025 14:56
@StanFromIreland StanFromIreland requested a review from encukou May 2, 2025 15:22
@StanFromIreland StanFromIreland requested a review from encukou May 3, 2025 15:17
@encukou
Copy link
Member

encukou commented May 5, 2025

I put more suggestions in StanFromIreland#1.

encukou and others added 2 commits May 5, 2025 14:27
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
max-heaps: Reword the docs, add more tests
Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more editing pass, and let's get this into 3.14 beta.
There'll be time until July to adjust the tests/docs/implementation, or revert the feature entirely.

@encukou encukou merged commit f5b7847 into python:main May 5, 2025
42 checks passed
@StanFromIreland StanFromIreland deleted the add-heapq-max branch May 5, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants