Skip to content

TYP: flatiter is missing __setitem__ #20915

@bashtage

Description

@bashtage

Describe the issue:

The typing information for __flatiter__ does not define __setitem__ and so attempts to assign fail.

Reproduce the code example:

import numpy as np

a = np.empty(10)
a.flat[[0,2,4,6,8]] = np.nan

Error message:

`Unsupported target for indexed assignment ("flatiter[ndarray[Any, dtype[floating[_64Bit]]]]")`

NumPy/Python version information:

1.22.1 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions