Clarification about NEP 40: NumPy Scalars and Type Hierarchy
See original GitHub issueAs a side note to the above datatype implementation: unlike the datatypes, the NumPy scalars currently do provide a type hierarchy
Got a little confused by the statement above given that issubclass(np.int64, np.integer).
Did it mean to say unlike the python datatypes
or unlike the other datatypes
instead ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
NEP 50 — Promotion rules for Python scalars
This NEP proposes to refactor the behaviour around two guiding principles: Values must never influence result type. NumPy scalars and 0-D arrays ...
Read more >Scalars — NumPy v1.24 Manual
Array scalars live in a hierarchy (see the Figure below) of data types. ... is present can be determined using other members of...
Read more >NEP 42 — New and extensible DTypes
NumPy has an existing class hierarchy for scalar types, as seen in the figure of NEP 40, and the new DType hierarchy will...
Read more >NEP 47 — Adopting the array API standard
Dtypes should not be assumed to have a class hierarchy by users, however we are free to implement it with a class hierarchy...
Read more >NEP 41 — First step towards a new datatype system
NEP 40 explains the shortcomings of NumPy's dtype implementation. ... “pythonic” datatype Python type object, with a clear class hierarchy.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well, its the conundrum… Of course from a type (theory, not class) point of view, the elements of an array of
>int8
and<int8
are obviously of the same typenp.int8
scalars. Maybe you could say the dtype only describes the type (i.e. scalar type/class) to the array. Which is also why you can argue that the dtype itself doesn’t need to have a hierarchy. It doesn’t actually need to serve the purpose of a type (with a hierarchy) since it is strictly associated to a scalar type/class that already has these properties.Thats kind-of what my last email on the list is about… And no, I do not know for certain what is the “right” way to see it 😃.
Agreed @rossbar ! Closing.