#NEWLINE# def __getitem__( self , key ) : #NEWLINE# #INDENT# if isinstance ( key , string_types ) : #NEWLINE# #INDENT# indx = _get_index ( self . array . names , key ) #NEWLINE# if ( ( indx < indx . start ) or ( indx > ( self . end - 1 ) ) ) : #NEWLINE# #INDENT# raise KeyError ( ( "Key '%s' does not exist." % key ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( key , slice ) : #NEWLINE# #INDENT# return type ( self ) ( self . array , self . row , key . start , key . stop , key . step , self ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# indx = self . _get_index ( key ) #NEWLINE# if ( indx > ( self . array . _nfields - 1 ) ) : #NEWLINE# #INDENT# raise IndexError ( 'Index out of bounds' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return self . array . field ( indx ) [ self . row ]