parameters: (self, index)
return_statement: return out
docstring: Return a new arrayterator.
docstring_summary: Return a new arrayterator.
docstring_tokens: Return a new arrayterator .
function: def __getitem__(self, index):
          """
          Return a new arrayterator.
  
          """
          # Fix index, handling ellipsis and incomplete slices.
          if not isinstance(index, tuple): index = (index,)
          fixed = []
          length, dims = len(index), len(self.shape)
          for slice_ in index:
              if slice_ is Ellipsis:
                  fixed.extend([slice(None)] * (dims-length+1))
                  length = len(fixed)
              elif isinstance(slice_, (int, long)):
                  fixed.append(slice(slice_, slice_+1, 1))
              else:
                  fixed.append(slice_)
          index = tuple(fixed)
          if len(index) < dims:
              index += (slice(None),) * (dims-len(index))
  
          # Return a new arrayterator object.
          out = self.__class__(self.var, self.buf_size)
          for i, (start, stop, step, slice_) in enumerate(
                  zip(self.start, self.stop, self.step, index)):
              out.start[i] = start + (slice_.start or 0)
              out.step[i] = step * (slice_.step or 1)
              out.stop[i] = start + (slice_.stop or stop-start)
              out.stop[i] = min(stop, out.stop[i])
          return out
function_tokens: def __getitem__ ( self , index ) : # Fix index, handling ellipsis and incomplete slices. if not isinstance ( index , tuple ) : index = ( index , ) fixed = [ ] length , dims = len ( index ) , len ( self . shape ) for slice_ in index : if slice_ is Ellipsis : fixed . extend ( [ slice ( None ) ] * ( dims - length + 1 ) ) length = len ( fixed ) elif isinstance ( slice_ , ( int , long ) ) : fixed . append ( slice ( slice_ , slice_ + 1 , 1 ) ) else : fixed . append ( slice_ ) index = tuple ( fixed ) if len ( index ) < dims : index += ( slice ( None ) , ) * ( dims - len ( index ) ) # Return a new arrayterator object. out = self . __class__ ( self . var , self . buf_size ) for i , ( start , stop , step , slice_ ) in enumerate ( zip ( self . start , self . stop , self . step , index ) ) : out . start [ i ] = start + ( slice_ . start or 0 ) out . step [ i ] = step * ( slice_ . step or 1 ) out . stop [ i ] = start + ( slice_ . stop or stop - start ) out . stop [ i ] = min ( stop , out . stop [ i ] ) return out