According to the docs, numpy scalars are supposed to have the same methods as arrays, but the astype method behaves differently by not accepting keyword arguments. This can cause issues for code that wants to accept scalars and arrays interchangeably e.g. see thunder-project/thunder#121 (not my use case, just the first hit I found).
Sample code (numpy 1.13.1):
>>> import numpy as np
>>> np.float64(1).astype(np.float32, casting='same_kind')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: astype() takes no keyword arguments
According to the docs, numpy scalars are supposed to have the same methods as arrays, but the
astypemethod behaves differently by not accepting keyword arguments. This can cause issues for code that wants to accept scalars and arrays interchangeably e.g. see thunder-project/thunder#121 (not my use case, just the first hit I found).Sample code (numpy 1.13.1):