MCPcopy Index your code
hub / github.com/python/cpython / logical_invert

Method logical_invert

Lib/_pydecimal.py:4746–4763  ·  view source on GitHub ↗

Invert all the digits in the operand. The operand must be a logical number. >>> ExtendedContext.logical_invert(Decimal('0')) Decimal('111111111') >>> ExtendedContext.logical_invert(Decimal('1')) Decimal('111111110') >>> ExtendedContext.logical_invert

(self, a)

Source from the content-addressed store, hash-verified

4744 return a.logical_and(b, context=self)
4745
4746 def logical_invert(self, a):
4747 """Invert all the digits in the operand.
4748
4749 The operand must be a logical number.
4750
4751 >>> ExtendedContext.logical_invert(Decimal('0'))
4752 Decimal('111111111')
4753 >>> ExtendedContext.logical_invert(Decimal('1'))
4754 Decimal('111111110')
4755 >>> ExtendedContext.logical_invert(Decimal('111111111'))
4756 Decimal('0')
4757 >>> ExtendedContext.logical_invert(Decimal('101010101'))
4758 Decimal('10101010')
4759 >>> ExtendedContext.logical_invert(1101)
4760 Decimal('111110010')
4761 """
4762 a = _convert_other(a, raiseit=True)
4763 return a.logical_invert(context=self)
4764
4765 def logical_or(self, a, b):
4766 """Applies the logical operation 'or' between each operand's digits.

Callers 1

test_logical_invertMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
logical_invertMethod · 0.45

Tested by 1

test_logical_invertMethod · 0.76