Skip to content

Add example of minheap and maxheap working together #137251

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 1 commit into from
Jul 30, 2025

Conversation

rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Jul 30, 2025

In Python 3.14, max-heaps were added to the heapq module. Add a classic example of a min-heap and max-heap working together.


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

@rhettinger rhettinger added docs Documentation in the Doc dir skip issue skip news needs backport to 3.14 bugs and security fixes labels Jul 30, 2025
@rhettinger rhettinger added the 3.15 new features, bugs and security fixes label Jul 30, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Jul 30, 2025
@StanFromIreland
Copy link
Member

This can be put under issue #133530

Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

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

LGTM

Just one little PEP8/257 nit

@rhettinger
Copy link
Contributor Author

This can be put under issue #133530

Though related, there is no benefit to connecting these. The other issue is about a separate part of the heapq docs and is mostly stylistic.

@rhettinger rhettinger merged commit dc05d47 into python:main Jul 30, 2025
38 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jul 30, 2025
@miss-islington-app
Copy link

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@rhettinger rhettinger deleted the running_median branch July 30, 2025 20:53
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 30, 2025
(cherry picked from commit dc05d47)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Jul 30, 2025

GH-137255 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.15 new features, bugs and security fixes docs Documentation in the Doc dir skip issue skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants