MCPcopy Index your code
hub / github.com/RustPython/RustPython / logical_and

Method logical_and

Lib/_pydecimal.py:4716–4741  ·  view source on GitHub ↗

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

(self, a, b)

Source from the content-addressed store, hash-verified

4714 return a.logb(context=self)
4715
4716 def logical_and(self, a, b):
4717 """Applies the logical operation 'and' between each operand's digits.
4718
4719 The operands must be both logical numbers.
4720
4721 >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
4722 Decimal('0')
4723 >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
4724 Decimal('0')
4725 >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
4726 Decimal('0')
4727 >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
4728 Decimal('1')
4729 >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
4730 Decimal('1000')
4731 >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
4732 Decimal('10')
4733 >>> ExtendedContext.logical_and(110, 1101)
4734 Decimal('100')
4735 >>> ExtendedContext.logical_and(Decimal(110), 1101)
4736 Decimal('100')
4737 >>> ExtendedContext.logical_and(110, Decimal(1101))
4738 Decimal('100')
4739 """
4740 a = _convert_other(a, raiseit=True)
4741 return a.logical_and(b, context=self)
4742
4743 def logical_invert(self, a):
4744 """Invert all the digits in the operand.

Callers 1

test_logical_andMethod · 0.95

Calls 2

_convert_otherFunction · 0.85
logical_andMethod · 0.45

Tested by 1

test_logical_andMethod · 0.76