Skip to content

DOC: clarify numpy.asarray parameter 'order' #29606

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

nbidler
Copy link

@nbidler nbidler commented Aug 21, 2025

See #28247. Made explicit that 'C' and 'F' can copy input to ensure output format, 'A' does not ensure contiguous output. Kept 'K' the same because all the stride analysis/flag-handling behavior should be extraneous to the end user.

nbidler and others added 7 commits August 14, 2025 23:39
Changed description to make explicit that setting 'A' requires
user to set 'copy' to 'True' to get the described behavior.
Made explicit that 'A' has two cases where it acts as
equivalent to setting 'F'. See 28247.
See 28247. Changed description of 'order' to make
the behavior of 'A' more explicit and how to cause it to
preserve non-contiguous Fortran-order. Changed description
of 'C' and 'F' to clarify that output will be contiguous.
See 28247. To differentiate between 'A' and 'K', made explicit
that 'A' will not ensure the output is contiguous. 'K' has more
complex behavior related to flags and stride detection, but will
try to keep the output as close as possible to the input.
See 28247. Made explicit that 'C' and 'F' can copy input to output,
'A' does not ensure contiguous output.
Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

Looks much clearer to me, but I'll leave to @seberg to merge. Cheers!

'C' gives a row-major layout (C-style),
'F' gives a column-major layout (Fortran-style).
'C' and 'F' will copy if needed to ensure the output format.
'A' (any) is equivalent to 'F' if input a is non-contiguous or Fortran-contiguous, otherwise, it is equivalent to 'C'. Unlike 'C' or 'F', 'A' does not ensure that the result is contiguous.
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, seems good, can you break the long line though?

Also, can you see which other places have the identical comment, we should change them all (where applicable, which might be some exceptions but not sure).

Copy link
Author

Choose a reason for hiding this comment

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

Will do.

  1. formality question: Is it okay to change it on my repo directly (since it's just replacing ' ' with '\n') or should I do the whole process again with "change locally, spin build, spin test, spin lint, push to personal repo, create new pull request?" Or is there a procedure to alter a repo that had a push request already made?
  2. Did you want me to hit up anywhere that had 'order' with 'A' and 'K' args, or anywhere that had the whole Fortran contiguous, ‘C’ otherwise ‘K’ (keep) preserve input order Defaults string (which has line-breaks but no punctuation)?

@melissawm melissawm moved this from Awaiting a code review to Pending authors' response in NumPy first-time contributor PRs Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Pending authors' response
Development

Successfully merging this pull request may close these issues.

3 participants