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

Method logical_xor

Lib/_pydecimal.py:4792–4817  ·  view source on GitHub ↗

Applies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) Decimal('1')

(self, a, b)

Source from the content-addressed store, hash-verified

4790 return a.logical_or(b, context=self)
4791
4792 def logical_xor(self, a, b):
4793 """Applies the logical operation 'xor' between each operand's digits.
4794
4795 The operands must be both logical numbers.
4796
4797 >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
4798 Decimal('0')
4799 >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
4800 Decimal('1')
4801 >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
4802 Decimal('1')
4803 >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
4804 Decimal('0')
4805 >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
4806 Decimal('110')
4807 >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
4808 Decimal('1101')
4809 >>> ExtendedContext.logical_xor(110, 1101)
4810 Decimal('1011')
4811 >>> ExtendedContext.logical_xor(Decimal(110), 1101)
4812 Decimal('1011')
4813 >>> ExtendedContext.logical_xor(110, Decimal(1101))
4814 Decimal('1011')
4815 """
4816 a = _convert_other(a, raiseit=True)
4817 return a.logical_xor(b, context=self)
4818
4819 def max(self, a, b):
4820 """max compares two values numerically and returns the maximum.

Callers 1

test_logical_xorMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
logical_xorMethod · 0.45

Tested by 1

test_logical_xorMethod · 0.76