Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TYP: Support iteration of StringDType arrays #29227

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
Jun 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2577,11 +2577,15 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
# `tuple[int]` to `tuple[Never]` or `tuple[int, int]` to `tuple[Never, Never]`.
# This way the bug only occurs for 9-D arrays, which are probably not very common.
@overload
def __iter__(self: ndarray[tuple[Never, Never, Never, Never, Never, Never, Never, Never, Never]], /) -> Iterator[Any]: ...
def __iter__(
self: ndarray[tuple[Never, Never, Never, Never, Never, Never, Never, Never, Never], Any], /
) -> Iterator[Any]: ...
@overload # == 1-d & dtype[T \ object_]
def __iter__(self: ndarray[tuple[int], dtype[_NonObjectScalarT]], /) -> Iterator[_NonObjectScalarT]: ...
@overload # == 1-d & StringDType
def __iter__(self: ndarray[tuple[int], dtypes.StringDType], /) -> Iterator[str]: ...
@overload # >= 2-d
def __iter__(self: ndarray[tuple[int, int, *tuple[int, ...]], dtype[_ScalarT]], /) -> Iterator[NDArray[_ScalarT]]: ...
def __iter__(self: ndarray[tuple[int, int, *tuple[int, ...]], _DTypeT], /) -> Iterator[ndarray[_AnyShape, _DTypeT]]: ...
@overload # ?-d
def __iter__(self, /) -> Iterator[Any]: ...

Expand Down
Loading