Skip to content
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

Use slice.indices() #364

Open
oerc0122 opened this issue Dec 4, 2024 · 0 comments
Open

Use slice.indices() #364

oerc0122 opened this issue Dec 4, 2024 · 0 comments

Comments

@oerc0122
Copy link
Collaborator

oerc0122 commented Dec 4, 2024

indices(...) method of builtins.slice instance
S.indices(len) -> (start, stop, stride)

Assuming a sequence of length `len`, calculate the start and stop
indices, and the stride length of the extended slice described by
S. Out of bounds indices are clipped in a manner consistent with the
handling of normal slices.

There is apparently a little known function on slices which could simplify a lot of the StartStopStep functionality.

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

No branches or pull requests

1 participant