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

Skip to content

nditer.__next__ keeps working after close is called #10950

@eric-wieser

Description

@eric-wieser

@mattip.

This surprises me a little:

>>> it = np.nditer(np.arange(3))
>>> next(it)
array(0)
>>> it.close()
>>> next(it)
array(1)
>>> next(it)
array(2)
>>> next(it)
StopIteration

Compare with

>>> def generator():
...    yield from range(3)

>>> it = generator()
>>> next(it)
0
>>> it.close()
>>> next(it)
StopIteration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions