Skip to content

Conversation

@jorenham
Copy link
Member

@jorenham jorenham commented Dec 29, 2025

The histogram function stubs were mostly incomplete, giving little type-safety. This adds (many) overloads for histogram_bin_edges, histogram, and histogramdd for specific input combinations to return specialized dtypes. This additionally changes the returned array types to include their (often 1d) shape-types.

Don't let the many overloads scare you; because just like with death metal, once you can get past the machine-gun blastbeats and gutteral pig-squealing, then you'll find that there are actually a couple of notes hidden in there. So static typing is basically the death metal of Python (in a good way). I guess that must be why I like it then 🤔.

@charris charris merged commit bd7db37 into numpy:main Dec 30, 2025
14 checks passed
@charris
Copy link
Member

charris commented Dec 30, 2025

Thanks Joren.

@jorenham jorenham deleted the typing/lib._histogram_impl-shape-typing branch December 30, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants