Skip to content

Commit fbef666

Browse files
authored
Merge pull request #889 from Mathics3/partial-arithmetic-refactor
Start to reduce/refactor arithmetic ...
2 parents 9b3575d + 7a1241c commit fbef666

18 files changed

+716
-681
lines changed

mathics/builtin/arithfns/basic.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
"""
33
Basic Arithmetic
44
5-
The functions here are the basic arithmetic operations that you might find on a calculator.
5+
The functions here are the basic arithmetic operations that you might find \
6+
on a calculator.
67
78
"""
89

9-
from mathics.builtin.arithmetic import _MPMathFunction, create_infix
10-
from mathics.builtin.base import BinaryOperator, Builtin, PrefixOperator, SympyFunction
10+
from mathics.builtin.arithmetic import create_infix
11+
from mathics.builtin.base import (
12+
BinaryOperator,
13+
Builtin,
14+
MPMathFunction,
15+
PrefixOperator,
16+
SympyFunction,
17+
)
1118
from mathics.core.atoms import (
1219
Complex,
1320
Integer,
@@ -387,7 +394,7 @@ def eval(self, items, evaluation):
387394
return eval_Plus(*items_tuple)
388395

389396

390-
class Power(BinaryOperator, _MPMathFunction):
397+
class Power(BinaryOperator, MPMathFunction):
391398
"""
392399
<url>
393400
:Exponentiation:
@@ -531,7 +538,7 @@ class Power(BinaryOperator, _MPMathFunction):
531538
def eval_check(self, x, y, evaluation):
532539
"Power[x_, y_]"
533540

534-
# Power uses _MPMathFunction but does some error checking first
541+
# Power uses MPMathFunction but does some error checking first
535542
if isinstance(x, Number) and x.is_zero:
536543
if isinstance(y, Number):
537544
y_err = y
@@ -788,7 +795,6 @@ def inverse(item):
788795
and isinstance(item.elements[1], (Integer, Rational, Real))
789796
and item.elements[1].to_sympy() < 0
790797
): # nopep8
791-
792798
negative.append(inverse(item))
793799
elif isinstance(item, Rational):
794800
numerator = item.numerator()

0 commit comments

Comments
 (0)