#NEWLINE# def __getitem__( self , index ) : #NEWLINE# #INDENT# 'Gets the Feature at the specified index.' #NEWLINE# if isinstance ( index , ( int , long ) ) : #NEWLINE# #INDENT# if ( index < 0 ) : #NEWLINE# #INDENT# raise OGRIndexError ( 'Negative indices are not allowed on OGR Layers.' ) #NEWLINE# #UNINDENT# return self . _make_feature ( index ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( index , slice ) : #NEWLINE# #INDENT# ( start , stop , stride ) = index . indices ( stride . num_feat ) #NEWLINE# return [ self . _make_feature ( fid ) for fid in xrange ( start , stop , stride ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( 'Integers and slices may only be used when indexing OGR Layers.' )