Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Don't allow initializing generic #77

Closed
@person142

Description

@person142

Follow up to #72.

The following currently passes mypy:

import numpy as np

reveal_type(np.generic(1))

but you can't actually create instances of generic:

>>> import numpy as np
>>> np.generic(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot create 'numpy.generic' instances

We should

  • Add constructors specifically to the classes that can be instantiated (np.float64 etc)
  • Remove the constructor from generic

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions