Applies an 'or' operation between self and other's digits. Both self and other must be logical numbers.
(self, other, context=None)
| 3370 | context) |
| 3371 | |
| 3372 | def logical_or(self, other, context=None): |
| 3373 | """Applies an 'or' operation between self and other's digits. |
| 3374 | |
| 3375 | Both self and other must be logical numbers. |
| 3376 | """ |
| 3377 | if context is None: |
| 3378 | context = getcontext() |
| 3379 | |
| 3380 | other = _convert_other(other, raiseit=True) |
| 3381 | |
| 3382 | if not self._islogical() or not other._islogical(): |
| 3383 | return context._raise_error(InvalidOperation) |
| 3384 | |
| 3385 | # fill to context.prec |
| 3386 | (opa, opb) = self._fill_logical(context, self._int, other._int) |
| 3387 | |
| 3388 | # make the operation, and clean starting zeroes |
| 3389 | result = "".join([str(int(a)|int(b)) for a,b in zip(opa,opb)]) |
| 3390 | return _dec_from_triple(0, result.lstrip('0') or '0', 0) |
| 3391 | |
| 3392 | def logical_xor(self, other, context=None): |
| 3393 | """Applies an 'xor' operation between self and other's digits. |