-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Improve description of array scalar in glossary #18965
Conversation
Distinction of array scalars and 0-dimension arrays. See issue numpy#17744. Co-authored-by: Jasmin Classen <39028086+jasmincl@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TheCheshireCat6 and @jasmincl! Overall this description looks good, there's just a small textual issue and a rendering issue:
You can see the result of the doc build after CI has run by clicking on "Details" here:
doc/source/glossary.rst
Outdated
For uniformity in handling operands, NumPy treats | ||
a :doc:`scalar <reference/arrays.scalars>` as an array of zero | ||
dimension. | ||
An :doc:` array scalar <reference/arrays.scalars>` is an instance of the types/classes float32, float64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The space after doc:
will be the cause of the rendering issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the same 2 lines below
doc/source/glossary.rst
Outdated
An :doc:` array scalar <reference/arrays.scalars>` is an instance of the types/classes float32, float64, | ||
etc.. For uniformity in handling operands, NumPy treats a scalar as | ||
an array of zero dimension. In contrast, a 0-dimensional array is an :doc:` ndarray <reference/arrays.ndarray>` instance | ||
containing precisely one array scalar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extended description is great, until "containing precisely one array scalar" which seems imprecise. An ndarray doesn't contain an array scalar - there's no instance of a dtype type inside the array container, just a number. How about rephrasing that to "containing precisely one value"?
One other thing: if you include |
Thanks for the quick feedback! We did not mention "closes gh-17744" because we want to add examples of code to .shape and .ndim with 0-dim ndarrays since we did not have time on Sunday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now, merging. Thanks @TheCheshireCat6 and @jasmincl!
Distinction of array scalars and 0-dimension arrays. See issue #17744.
Co-authored-by: Jasmin Classen 39028086+jasmincl@users.noreply.github.com