Skip to content

Clarify that constants are Python scalars #169

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

Merged
merged 3 commits into from
May 31, 2021
Merged

Clarify that constants are Python scalars #169

merged 3 commits into from
May 31, 2021

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Apr 26, 2021

This PR

  • clarifies that constants are Python scalars.

Currently, the spec does not indicate how the constants should be exposed (e.g., Python scalars, zero-dimensional arrays, etc). This PR aims to remedy this.

The choice of Python scalar, rather than as a zero-dimensional array with a dtype described in the specification, stems from greater flexibility in how these constants participate in operations.

For example, according to the current specification, pi would be truncated when participating in an operation with an array having an integer dtype, which may not be the case if pi was a zero-dimensional float64 array and participating in mixed-type promotion.

Further, as a Python scalar, pi would be converted to a float32 array when participating in an operation with an array having a float32 dtype, which would not be the case if pi was a zero-dimensional float64 array.

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @kgryte

@leofang
Copy link
Contributor

leofang commented Apr 27, 2021

By merging this PR, I assume we can safely ignore #154?

@rgommers
Copy link
Member

By merging this PR, I assume we can safely ignore #154?

Don't know, could still be relevant. Would be nice to see a few more opinions on it. Let me comment on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Narrative Content Narrative documentation content.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants