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
Description
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