Commit ba67281
authored
MAINT: ban setting
See discussion in https://github.com/numpy/numpy-stubs/issues/7.
Though this is valid NumPy, users should be using `ndarray.view`
instead of setting the dtype, and setting the dtype prevents sensibly
making `ndarray` generic over dtype because of situations like this:
```
x = np.ones((2,), dtype=np.int64) # type is ndarray[np.int64]
x.dtype = np.bool_ # What is the type now?
```
If someone really wants to do this, they will now have add an ignore,
which should make it clear that type safety is going out the window.ndarray.dtype (numpy#47)1 parent 7d44d93 commit ba67281
3 files changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
301 | | - | |
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments