Skip to content

Instantly share code, notes, and snippets.

@geojeff
Last active December 19, 2015 10:59
Show Gist options
  • Save geojeff/5944614 to your computer and use it in GitHub Desktop.
Save geojeff/5944614 to your computer and use it in GitHub Desktop.
data = [0,1,2,3,4,5,6,7,8,9]
start_index = 0
end_index = 2
slice_indices = range(start_index, end_index + 1)
len_slice_indices = len(slice_indices)
len_data = len(data)
if not (0 <= start_index <= len_data - len(slice_indices)
and
len_slice_indices - 1 <= end_index < len_data):
print 'violation', start_index, end_index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment