ndarray.pyi 405 B

1234567891011
  1. import numpy as np
  2. # Ban setting dtype since mutating the type of the array in place
  3. # makes having ndarray be generic over dtype impossible. Generally
  4. # users should use `ndarray.view` in this situation anyway. See
  5. #
  6. # https://github.com/numpy/numpy-stubs/issues/7
  7. #
  8. # for more context.
  9. float_array = np.array([1.0])
  10. float_array.dtype = np.bool_ # E: Property "dtype" defined in "ndarray" is read-only