Skip to content

Commit

Permalink
Merge pull request #55 from jakirkham/more_doc__index_to_slice
Browse files Browse the repository at this point in the history
Note index and slice failure cases in `index_to_slice`
  • Loading branch information
jakirkham committed Feb 17, 2017
2 parents c5eac1f + 191ff05 commit 4fcb0c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kenjutsu/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ def index_to_slice(index):
Convert an index to a slice.
Note:
A single index behaves differently from a length 1 slice. When
A single index behaves differently from a length 1 ``slice``. When
applying the former one reduces that dimension; whereas, applying
the latter results in a singleton dimension being retained.
the latter results in a singleton dimension being retained. Also
if an index is out of bounds, one gets an ``IndexError``. However,
with an out of bounds length 1 ``slice``, one simply doesn't get
the requested range.
Args:
index(int): an index to convert to a slice
Expand Down

0 comments on commit 4fcb0c8

Please sign in to comment.