Skip to content

DOC: fix incomplete parameter description and examples in as_strided - #33103

Open
pereradrian wants to merge 1 commit into
numpy:mainfrom
pereradrian:doc-as-strided-param
Open

pereradrian wants to merge 1 commit into
numpy:mainfrom
pereradrian:doc-as-strided-param

Conversation

@pereradrian

Copy link
Copy Markdown
Contributor

PR summary

Small fixes to the numpy.lib.stride_tricks.as_strided docstring:

  • The description of x was an incomplete sentence ("Array to create a new."); it now reads "Array to create a new view of."
  • check_bounds is now marked as optional, with its default (None, no check) documented.
  • The examples hard-coded strides=(8,) and strides=(400,), which assume an 8-byte integer dtype and contradict the Notes, which advise basing new strides on x.strides. They now use x.strides and 50 * a.strides[0].
  • In the examples, separate statements were written as ... continuation lines. They now use >>> prompts, as in the rest of the docs.
  • Minor wording fixes: "See also" → "See Also", "userfriendly" → "user-friendly", "self overlapping" → "self-overlapping", and "as_strided will raises an error".

The last example now shows c (array([ 0, 50])) instead of c[0], c[1], so the output does not depend on how NumPy scalars are printed.

Documentation-only change; no behavior changes.

First time contributor introduction

This is my third PR, after #33092 and #33094. I use Python for work, for my studies and for personal projects.

AI Disclosure

I used Claude (Anthropic) to review the as_strided docstring, draft these fixes and draft this PR description. I reviewed every change and ran the updated examples with doctest, and I take responsibility for the change. I'll handle all review discussion myself.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant