Skip to content

ENH: Add __getitem__ to flatiter type definition #17113

@bashtage

Description

@bashtage

Reproducing code example:

Run mypy on a simple file

import numpy as np

a = np.empty((2,2))
b = a.flat[[0,1]]

Error message:

You will get

error: Value of type "flatiter[ndarray]" is not indexable

Need to add __getitem__ to pyi file.

Numpy/Python version information:

1.20.0.dev0+986e533 3.8.3 (default, Jul  2 2020, 16:21:59)
[GCC 7.3.0]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions