#NEWLINE# def __getitem__( self , key ) : #NEWLINE# #INDENT# if ( type ( key ) is slice ) : #NEWLINE# #INDENT# size = len ( self ) #NEWLINE# ( start , stop , step ) = key . indices ( size ) #NEWLINE# if ( start is None ) : #NEWLINE# #INDENT# start = self . pos #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# start += self . pos #NEWLINE# #UNINDENT# if ( stop is not None ) : #NEWLINE# #INDENT# stop += self . pos #NEWLINE# #UNINDENT# return self . text [ slice ( start , stop , step ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key < 0 ) : #NEWLINE# #INDENT# return self . text [ key ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . text [ ( self . pos + key ) ]