Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
asmeurer committed Feb 7, 2024
1 parent d49cd53 commit 558dc3d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ndindex/ndindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,14 @@ def selected_indices(self, shape, axis=0):
>>> from ndindex import Slice, Tuple
>>> idx = Slice(5, 10)
>>> list(idx.selected_indices(20))
[5, 6, 7, 8, 9]
[Integer(5), Integer(6), Integer(7), Integer(8), Integer(9)]
>>> idx = Tuple(Slice(5, 10), Slice(0, 2))
>>> list(idx.selected_indices((20, 3)))
[(5, 0), (5, 1), (6, 0), (6, 1), (7, 0), (7, 1), (8, 0), (8, 1), (9, 0), (9, 1)]
[Tuple(5, 0), Tuple(5, 1),
Tuple(6, 0), Tuple(6, 1),
Tuple(7, 0), Tuple(7, 1),
Tuple(8, 0), Tuple(8, 1),
Tuple(9, 0), Tuple(9, 1)]
To correspond these indices to the elements of `a[idx]`, you can use
`iter_indices(idx.newshape(shape))`, since both iterators iterate the
Expand Down

0 comments on commit 558dc3d

Please sign in to comment.