Skip to content

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