Repository navigation
doc: rewrite slice basic-indexing docs, accept 1-tuple indexers - #117
Merged
Merged
Conversation
Add TryFrom<(F1,)> to impl_from_tuple_to_axes_index!, mirroring the arity 2-10 arms, so `(1..4,)` indexes like `1..4` for AxesIndex<Indexer> and `(3,)` works as a 1-D shape/axes list for AxesIndex<isize>/<usize>. Unit test test_one_tuple_index covers both paths through dim_slice. Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: glm-5.3 <service@zhipuai.cn>
…g.md Move the slice anchor docstring into a standalone markdown attached by include_str!, rewritten around the preferred tensor.i() + tuple call forms: overloads table (per-axis indexers, whole-index forms), easy first steps then elaborated sections (ranges/clamping, stepped slices and reversal, integer selection, None/NewAxis placement, Ellipsis, view/layout semantics, contiguity and to_contig, into_slice, chaining, mutable writes incl. the *&mut place idiom, runtime values), an ownership table, and compile-error tips (..=, &Vec, += on i_mut, chained temporaries) with compile_fail + pasted diagnostics. All examples are byte-verified through the doc_draft twins (doc_slice* in tests/doc_draft/indexing), incl. NumPy 2.5.2 parity of newaxis/ellipsis placement. Semantics documented in the registry: no ..= bounds, Some(n) always panics (intentional); the missing one-element-tuple form is resolved by the rstsr-common companion commit. Co-authored-by: Claude Code <noreply@anthropic.com> Co-authored-by: glm-5.3 <service@zhipuai.cn>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
New features
AxesIndexconversions accept one-element tuples:a.i((1..4,))indexes likea.i(1..4), and(3,)works as a 1-D shape/axes list, matching arities 2-10.Enhancement
slicebasic-indexing documentation around the preferredtensor.i()+ tuple call forms, as a standalonesrc/docs/basic_indexing.mdattached to the anchor by
include_str!(first crate docs page authored thisway).
Details
doc_drafttwins(
tests/doc_draft/indexing), including NumPy-parity of newaxis/ellipsisplacement against the pinned NumPy 2.5.2.
tests/tracking/numpy_differences.md: no inclusive (..=) bounds, andSome(n)as an indexer always panics. The previously missingone-element-tuple form is resolved by the
rstsr-commoncommit here (asingle
TryFrom<(F1,)>macro arm; no coherence conflicts)...=,&Vec,+=oni_mut, chained temporaries) usecompile_failfences with pasted real diagnostics.PR summarized by Claude Code noreply@anthropic.com, glm-5.3 service@zhipuai.cn