#NEWLINE# def __getitem__( self , index ) : #NEWLINE# #INDENT# '\n        Return a new arrayterator.\n\n        ' #NEWLINE# if ( not isinstance ( index , tuple ) ) : #NEWLINE# #INDENT# index = ( index , ) #NEWLINE# #UNINDENT# fixed = [ ] #NEWLINE# ( length , dims ) = ( len ( index ) , len ( self . shape ) ) #NEWLINE# for slice_ in index : #NEWLINE# #INDENT# if ( slice_ is Ellipsis ) : #NEWLINE# #INDENT# fixed . extend ( ( [ slice ( None ) ] * ( ( dims - length ) + 1 ) ) ) #NEWLINE# length = len ( fixed ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( slice_ , ( int , long ) ) : #NEWLINE# #INDENT# fixed . append ( slice ( slice_ , ( slice_ + 1 ) , 1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fixed . append ( slice_ ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# index = tuple ( fixed ) #NEWLINE# if ( len ( index ) < dims ) : #NEWLINE# #INDENT# index += ( ( slice ( None ) , ) * ( dims - len ( index ) ) ) #NEWLINE# #UNINDENT# out = self . __class__ ( self . var , self . buf_size ) #NEWLINE# for ( i , ( start , stop , step , slice_ ) ) in enumerate ( zip ( self . start , self . stop , self . step , index ) ) : #NEWLINE# #INDENT# log . debug ( ( 'type of out: %s' % type ( out ) ) ) #NEWLINE# log . debug ( ( 'slice_: %s' % str ( slice_ ) ) ) #NEWLINE# out . start [ i ] = ( start + ( slice_ . start or 0 ) ) #NEWLINE# out . step [ i ] = ( step * ( slice_ . step or 1 ) ) #NEWLINE# out . stop [ i ] = ( start + ( slice_ . stop or ( stop - start ) ) ) #NEWLINE# out . stop [ i ] = min ( stop , out . stop [ i ] ) #NEWLINE# #UNINDENT# return out