Skip to content

TYP: datetime_as_string improved shape-typing - #32647

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/datetime_as_string/shape-typing
Sep 16, 2026
Merged

charris merged 1 commit into
numpy:mainfrom
jorenham:typing/datetime_as_string/shape-typing

Conversation

@jorenham

Copy link
Copy Markdown
Member

np.datetime_as_string now also returns an exact shape-type for 1d and 2d (nested) sequences of np.datetime64 input. This also fixes the incomatible overlap in the overloads, and removes dt.date as accepted type (it'll raise at runtime).
This also introduces a type alias for >=1d shapes for the sake of DRY (x7), so this also lightly touches some other lines.


Pair programmed with AI.

@jorenham jorenham added this to the 2.6.0 Release milestone Sep 16, 2026
@charris
charris merged commit 5a3b626 into numpy:main Sep 16, 2026
16 checks passed
@charris

charris commented Sep 16, 2026

Copy link
Copy Markdown
Member

Thanks Joren.

@jorenham
jorenham deleted the typing/datetime_as_string/shape-typing branch September 16, 2026 16: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