question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarification about NEP 40: NumPy Scalars and Type Hierarchy

See original GitHub issue

As 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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sebergcommented, Apr 21, 2020

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 type np.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 😃.

0reactions
anirudh2290commented, Jul 13, 2020

Agreed @rossbar ! Closing.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found