(self, index)
return self._rows[y][x]
Extract items by [y, x] indexing or slicing or 1D index.
Extract items by [y, x] indexing or slicing or 1D index.
Extract items by [ y x ] indexing or slicing or 1D index .
def __getitem__(self, index):
        """Extract items by [y, x] indexing or slicing or 1D index."""
        y, x = index
        if isinstance(y, slice):
            if isinstance(x, slice):
                return self._create_from_rows([_row[x] for _row in self._rows[y]])
            else:
                return self._create_from_rows([bytearray([_row[x]]) for _row in self._rows[y]])
        if isinstance(x, slice):
            return self._create_from_rows([self._rows[y][x]])
        return self._rows[y][x]
def __getitem__ ( self , index ) : y , x = index if isinstance ( y , slice ) : if isinstance ( x , slice ) : return self . _create_from_rows ( [ _row [ x ] for _row in self . _rows [ y ] ] ) else : return self . _create_from_rows ( [ bytearray ( [ _row [ x ] ] ) for _row in self . _rows [ y ] ] ) if isinstance ( x , slice ) : return self . _create_from_rows ( [ self . _rows [ y ] [ x ] ] ) return self . _rows [ y ] [ x ]