TYP: ``inner`` shape-typing and transparent dtypes by jorenham · Pull Request #31133 · numpy/numpy · GitHub
Skip to content

TYP: inner shape-typing and transparent dtypes - #31133

Merged
charris merged 2 commits into
numpy:mainfrom
jorenham:typing/inner
Apr 3, 2026
Merged

charris merged 2 commits into
numpy:mainfrom
jorenham:typing/inner

Conversation

@jorenham

@jorenham jorenham commented Apr 3, 2026

Copy link
Copy Markdown
Member

numpy.inner was effectively untyped, because doing so would require some tricky shape-typing acrobatics.
I finally got around to it, and added shape-typing support for mixed 1d and 2d inputs, overloads for pure-python 1d array-likes (i.e. flat sequences) with mixed scalar-types, and special-casing for object dtypes.
Those weird first two _ArrayJustND overloads that have Never in their input shape types are workarounds for mypy and pyright, which (still) don't treat overloads as dictated by the typing spec (grumble).

AI Disclosure

I am not a robot ☑️

@jorenham jorenham added this to the 2.5.0 Release milestone Apr 3, 2026
@charris
charris merged commit 9a23020 into numpy:main Apr 3, 2026
14 checks passed
@charris

charris commented Apr 3, 2026

Copy link
Copy Markdown
Member

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