Skip to content

Commit 50eb822

Browse files
committed
address review: use "logical numbers" term
1 parent 961b08c commit 50eb822

File tree

3 files changed

+33
-54
lines changed

3 files changed

+33
-54
lines changed

Lib/_pydecimal.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,8 +3342,7 @@ def _fill_logical(self, context, opa, opb):
33423342
def logical_and(self, other, context=None):
33433343
"""Applies an 'and' operation between self and other's digits.
33443344
3345-
Both self and other should have zero sign and exponent,
3346-
and digits either 0 or 1.
3345+
Both self and other must be logical numbers.
33473346
"""
33483347
if context is None:
33493348
context = getcontext()
@@ -3363,7 +3362,7 @@ def logical_and(self, other, context=None):
33633362
def logical_invert(self, context=None):
33643363
"""Invert all its digits.
33653364
3366-
The self should have zero sign and exponent, and digits either 0 or 1.
3365+
The self must be logical number.
33673366
"""
33683367
if context is None:
33693368
context = getcontext()
@@ -3373,8 +3372,7 @@ def logical_invert(self, context=None):
33733372
def logical_or(self, other, context=None):
33743373
"""Applies an 'or' operation between self and other's digits.
33753374
3376-
Both self and other should have zero sign and exponent,
3377-
and digits either 0 or 1.
3375+
Both self and other must be logical numbers.
33783376
"""
33793377
if context is None:
33803378
context = getcontext()
@@ -3394,8 +3392,7 @@ def logical_or(self, other, context=None):
33943392
def logical_xor(self, other, context=None):
33953393
"""Applies an 'xor' operation between self and other's digits.
33963394
3397-
Both self and other should have zero sign and exponent,
3398-
and digits either 0 or 1.
3395+
Both self and other must be logical numbers.
33993396
"""
34003397
if context is None:
34013398
context = getcontext()
@@ -4719,8 +4716,7 @@ def logb(self, a):
47194716
def logical_and(self, a, b):
47204717
"""Applies the logical operation 'and' between each operand's digits.
47214718
4722-
Both operands should have zero sign and exponent, and
4723-
digits either 0 or 1.
4719+
The operands must be both logical numbers.
47244720
47254721
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
47264722
Decimal('0')
@@ -4747,8 +4743,7 @@ def logical_and(self, a, b):
47474743
def logical_invert(self, a):
47484744
"""Invert all the digits in the operand.
47494745
4750-
The operand should have zero sign and exponent, and digits
4751-
either 0 or 1.
4746+
The operand must be a logical number.
47524747
47534748
>>> ExtendedContext.logical_invert(Decimal('0'))
47544749
Decimal('111111111')
@@ -4767,8 +4762,7 @@ def logical_invert(self, a):
47674762
def logical_or(self, a, b):
47684763
"""Applies the logical operation 'or' between each operand's digits.
47694764
4770-
Both operands should have zero sign and exponent, and digits
4771-
either 0 or 1.
4765+
The operands must be both logical numbers.
47724766
47734767
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
47744768
Decimal('0')
@@ -4795,8 +4789,7 @@ def logical_or(self, a, b):
47954789
def logical_xor(self, a, b):
47964790
"""Applies the logical operation 'xor' between each operand's digits.
47974791
4798-
Both operands should have zero sign and exponent, and digits
4799-
either 0 or 1.
4792+
The operands must be both logical numbers.
48004793
48014794
>>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
48024795
Decimal('0')

Modules/_decimal/_decimal.c

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5237,13 +5237,13 @@ _decimal.Decimal.logical_invert = _decimal.Decimal.exp
52375237
52385238
Invert all its digits.
52395239
5240-
The self should have zero sign and exponent, and digits either 0 or 1.
5240+
The self must be logical number.
52415241
[clinic start generated code]*/
52425242

52435243
static PyObject *
52445244
_decimal_Decimal_logical_invert_impl(PyObject *self, PyTypeObject *cls,
52455245
PyObject *context)
5246-
/*[clinic end generated code: output=c626ed4b104a97b7 input=fb9eb6253e7639e1]*/
5246+
/*[clinic end generated code: output=c626ed4b104a97b7 input=7158d5b525417955]*/
52475247
Dec_UnaryFuncVA(mpd_qinvert)
52485248

52495249
/*[clinic input]
@@ -5475,44 +5475,41 @@ _decimal.Decimal.logical_and = _decimal.Decimal.compare
54755475
54765476
Applies an 'and' operation between self and other's digits.
54775477
5478-
Both self and other should have zero sign and exponent,
5479-
and digits either 0 or 1.
5478+
Both self and other must be logical numbers.
54805479
[clinic start generated code]*/
54815480

54825481
static PyObject *
54835482
_decimal_Decimal_logical_and_impl(PyObject *self, PyTypeObject *cls,
54845483
PyObject *other, PyObject *context)
5485-
/*[clinic end generated code: output=9a4cbb74c180b0bb input=f8857b9b57be75f3]*/
5484+
/*[clinic end generated code: output=9a4cbb74c180b0bb input=f22460f1285782d2]*/
54865485
Dec_BinaryFuncVA(mpd_qand)
54875486

54885487
/*[clinic input]
54895488
_decimal.Decimal.logical_or = _decimal.Decimal.compare
54905489
54915490
Applies an 'or' operation between self and other's digits.
54925491
5493-
Both self and other should have zero sign and exponent,
5494-
and digits either 0 or 1.
5492+
Both self and other must be logical numbers.
54955493
[clinic start generated code]*/
54965494

54975495
static PyObject *
54985496
_decimal_Decimal_logical_or_impl(PyObject *self, PyTypeObject *cls,
54995497
PyObject *other, PyObject *context)
5500-
/*[clinic end generated code: output=063c4de18dc41ecb input=4043d61390b2a07d]*/
5498+
/*[clinic end generated code: output=063c4de18dc41ecb input=b5afa1e1fdebdfce]*/
55015499
Dec_BinaryFuncVA(mpd_qor)
55025500

55035501
/*[clinic input]
55045502
_decimal.Decimal.logical_xor = _decimal.Decimal.compare
55055503
55065504
Applies an 'xor' operation between self and other's digits.
55075505
5508-
Both self and other should have zero sign and exponent,
5509-
and digits either 0 or 1.
5506+
Both self and other must be logical numbers.
55105507
[clinic start generated code]*/
55115508

55125509
static PyObject *
55135510
_decimal_Decimal_logical_xor_impl(PyObject *self, PyTypeObject *cls,
55145511
PyObject *other, PyObject *context)
5515-
/*[clinic end generated code: output=829b09cb49926ad7 input=faea7766e521bdde]*/
5512+
/*[clinic end generated code: output=829b09cb49926ad7 input=84d722ada08a2da7]*/
55165513
Dec_BinaryFuncVA(mpd_qxor)
55175514

55185515
/*[clinic input]
@@ -7112,8 +7109,7 @@ _decimal.Context.logical_invert = _decimal.Context.abs
71127109
71137110
Invert all the digits in the operand.
71147111
7115-
The operand should have zero sign and exponent, and digits
7116-
either 0 or 1.
7112+
The operand must be a logical number.
71177113
71187114
>>> ExtendedContext.logical_invert(Decimal('0'))
71197115
Decimal('111111111')
@@ -7130,7 +7126,7 @@ either 0 or 1.
71307126
static PyObject *
71317127
_decimal_Context_logical_invert_impl(PyObject *context, PyTypeObject *cls,
71327128
PyObject *x)
7133-
/*[clinic end generated code: output=97760277a958e2b0 input=c10bbdfd8d864be6]*/
7129+
/*[clinic end generated code: output=97760277a958e2b0 input=8e568f4c745ab596]*/
71347130
DecCtx_UnaryFunc(mpd_qinvert)
71357131

71367132
/*[clinic input]
@@ -7289,8 +7285,7 @@ _decimal.Context.logical_and = _decimal.Context.add
72897285
72907286
Applies the logical operation 'and' between each operand's digits.
72917287
7292-
Both operands should have zero sign and exponent, and
7293-
digits either 0 or 1.
7288+
The operands must be both logical numbers.
72947289
72957290
>>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
72967291
Decimal('0')
@@ -7315,16 +7310,15 @@ digits either 0 or 1.
73157310
static PyObject *
73167311
_decimal_Context_logical_and_impl(PyObject *context, PyTypeObject *cls,
73177312
PyObject *x, PyObject *y)
7318-
/*[clinic end generated code: output=009dfa08ecaa2ac8 input=771aebf6de97e246]*/
7313+
/*[clinic end generated code: output=009dfa08ecaa2ac8 input=bcb7d3d6ab7530de]*/
73197314
DecCtx_BinaryFunc(mpd_qand)
73207315

73217316
/*[clinic input]
73227317
_decimal.Context.logical_or = _decimal.Context.add
73237318
73247319
Applies the logical operation 'or' between each operand's digits.
73257320
7326-
Both operands should have zero sign and exponent, and digits
7327-
either 0 or 1.
7321+
The operands must be both logical numbers.
73287322
73297323
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
73307324
Decimal('0')
@@ -7349,16 +7343,15 @@ either 0 or 1.
73497343
static PyObject *
73507344
_decimal_Context_logical_or_impl(PyObject *context, PyTypeObject *cls,
73517345
PyObject *x, PyObject *y)
7352-
/*[clinic end generated code: output=eb38617e8d31bf12 input=380611292d885f9d]*/
7346+
/*[clinic end generated code: output=eb38617e8d31bf12 input=47b45d296fb90846]*/
73537347
DecCtx_BinaryFunc(mpd_qor)
73547348

73557349
/*[clinic input]
73567350
_decimal.Context.logical_xor = _decimal.Context.add
73577351
73587352
Applies the logical operation 'xor' between each operand's digits.
73597353
7360-
Both operands should have zero sign and exponent, and digits
7361-
either 0 or 1.
7354+
The operands must be both logical numbers.
73627355
73637356
>>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
73647357
Decimal('0')
@@ -7383,7 +7376,7 @@ either 0 or 1.
73837376
static PyObject *
73847377
_decimal_Context_logical_xor_impl(PyObject *context, PyTypeObject *cls,
73857378
PyObject *x, PyObject *y)
7386-
/*[clinic end generated code: output=23cd81fdcd865d5a input=a23b928a8d0f5df0]*/
7379+
/*[clinic end generated code: output=23cd81fdcd865d5a input=fcaaf828c1d2d089]*/
73877380
DecCtx_BinaryFunc(mpd_qxor)
73887381

73897382
/*[clinic input]

Modules/_decimal/clinic/_decimal.c.h

Lines changed: 9 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)