Skip to content

TYP: transpose and matrix_transpose shape-typing#31124

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/transpose-shapetyping
Apr 3, 2026
Merged

TYP: transpose and matrix_transpose shape-typing#31124
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/transpose-shapetyping

Conversation

@jorenham
Copy link
Copy Markdown
Member

@jorenham jorenham commented Apr 2, 2026

This adds shape-typing support for

  • transpose
  • matrix_transpose
  • ma.transpose

The ndim is preserved for these functions. And because shape-types don't describe the length of individual axes (see numpy/numtype#578 for why that is), we can simply return the entire ndarray input type (including its shape-type).

Related to #31120 and #31123

AI Disclosure

I am not a robot ☑️

@jorenham jorenham added this to the 2.5.0 Release milestone Apr 2, 2026
@charris charris merged commit de338ef into numpy:main Apr 3, 2026
15 checks passed
@jorenham jorenham deleted the typing/transpose-shapetyping branch April 3, 2026 08:02
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