This repository was archived by the owner on Jan 22, 2026. It is now read-only.
Description It is a nice oddity of slices that they never raise an IndexError. I've found two uses of slices which cause them.
> >> [0 , 1 , 2 , 3 ][slice (99 ,- 99 )]
[]
> >> AllStrings ("[abcdef]" )[slice (99 ,- 99 )]
Traceback (most recent call last ):
File "sre_yield/__init__.py" , line 137 , in __getitem__
result = SlicedSequence (self , slicer = i )
File "sre_yield/__init__.py" , line 167 , in __init__
self .start , self .stop , self .step = slice_indices (slicer , raw .__len__ ())
File "sre_yield/__init__.py" , line 97 , in slice_indices
stop = _adjust_index (stop , size )
File "sre_yield/__init__.py" , line 107 , in _adjust_index
raise IndexError ("Out of range" )
IndexError : Out of range
> >> "abcdef" [99 ::- 1 ]
'fedcba'
> >> AllStrings ("[abcdef]" )[99 ::- 1 ]
Traceback (most recent call last ):
File "sre_yield/__init__.py" , line 140 , in __getitem__
result = [item for item in result ]
File "sre_yield/__init__.py" , line 140 , in < listcomp >
result = [item for item in result ]
File "sre_yield/__init__.py" , line 148 , in __iter__
yield self .get_item (i )
File "sre_yield/__init__.py" , line 176 , in get_item
return self .raw [j ]
File "sre_yield/__init__.py" , line 144 , in __getitem__
return self .get_item (i )
File "re_yield/__init__.py" , line 405 , in get_item
return super ().get_item (i )
File "sre_yield/__init__.py" , line 126 , in get_item
return self .raw .get_item (i , d )
File "sre_yield/__init__.py" , line 217 , in get_item
raise IndexError ("Index %d out of bounds" % (i ,))
IndexError : Index 6 out of bounds Reactions are currently unavailable
It is a nice oddity of slices that they never raise an IndexError. I've found two uses of slices which cause them.