Hi all, In https://github.com/numpy/numpy/pull/15534 I would like to start deprecating creating dtypes from "abstract" scalar classes, such as:
np.dtype(np.floating) is np.dtype(np.float64) While, at the same time, `isinstance(np.float32, np.floating)` is true. Right now `arr.astype(np.floating, copy=False)` and, more obviously, `arr.astype(np.dtype(np.floating), copy=False)` will cast a float32 array to float64. I think we should deprecate this, to consistently enable that in the future `dtype=np.floating` may choose to not cast a float32 array. Of course for the `astype` call the DeprecationWarning would be changed to a FutureWarning before we change the result value. A slight (but hopefully rare) annoyance is that `np.integer` might be used since it reads fairly well compared to `np.int_`. The large upstream packages such as SciPy or astropy seem to be clean in this regard, though (at least almost clean). Does anyone think this is a bad idea? To me these deprecations seem fairly straight forward, possibly flush out bugs/unintended behaviour, and necessary for consistent future behaviour. (More similar ones may have to follow). If there is some, but not much, hesitation, I can also add this to the NEP 41 draft. Although I currently feel it is the right thing to do even if we never had any new dtypes. - Sebastian
signature.asc
Description: This is a digitally signed message part
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion