(self, rhs, oper)
Helper for elementwise operations.
Helper for elementwise operations.
Helper for elementwise operations .
def _elementwise_list(self, rhs, oper):
        """Helper for elementwise operations."""
        if isinstance(rhs, int):
            return [
                bytearray(oper(_lbyte, rhs) for _lbyte in iterbytes(_lrow))
                for _lrow in self._rows
            ]
        else:
            assert self._height == rhs._height
            assert self._width == rhs._width
            return [
                bytearray(
                    oper(_lbyte, _rbyte)
                    for _lbyte, _rbyte in zip(iterbytes(_lrow), iterbytes(_rrow))
                )
                for _lrow, _rrow in zip(self._rows, rhs._rows)
            ]
def _elementwise_list ( self , rhs , oper ) : if isinstance ( rhs , int ) : return [ bytearray ( oper ( _lbyte , rhs ) for _lbyte in iterbytes ( _lrow ) ) for _lrow in self . _rows ] else : assert self . _height == rhs . _height assert self . _width == rhs . _width return [ bytearray ( oper ( _lbyte , _rbyte ) for _lbyte , _rbyte in zip ( iterbytes ( _lrow ) , iterbytes ( _rrow ) ) ) for _lrow , _rrow in zip ( self . _rows , rhs . _rows ) ]