-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Open
Labels
component: numpy.datetime64(and timedelta64)(and timedelta64)
Description
This is particularly inconsistent because this isn't the case for datetime64:
In [12]: issubclass(np.timedelta64, np.integer)
Out[12]: True
In [13]: issubclass(np.datetime64, np.integer)
Out[13]: False
Looking at the subclass hierarchy, we observe:
In [15]: np.datetime64.mro()
Out[15]: [numpy.datetime64, numpy.generic, object]
In [16]: np.timedelta64.mro()
Out[16]:
[numpy.timedelta64,
numpy.signedinteger,
numpy.integer,
numpy.number,
numpy.generic,
object]
I would suggest that we make np.timedelta64 also inherit directly from np.generic.
I'm sure there was a reason for this originally, but in my experience this sort of sloppiness around type casting leads to bugs and confusion (e.g., see pydata/xarray#1952).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component: numpy.datetime64(and timedelta64)(and timedelta64)