Skip to content

Commit 15d9bfc

Browse files
authored
Merge pull request #1044 from mathics/SymbolTrue-SymbolFalse
Symbol("True') and Symbol("False')
2 parents 00a1a1f + 19031d7 commit 15d9bfc

8 files changed

Lines changed: 551 additions & 406 deletions

File tree

mathics/builtin/arithmetic.py

Lines changed: 346 additions & 270 deletions
Large diffs are not rendered by default.

mathics/builtin/calculus.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88
from mathics.builtin.base import Builtin, PostfixOperator, SympyFunction
9-
from mathics.core.expression import Expression, Integer, Number
9+
from mathics.core.expression import (Expression, Integer, Number, SymbolTrue, SymbolFalse)
1010
from mathics.core.convert import (
1111
sympy_symbol_prefix, SympyExpression, from_sympy)
1212
from mathics.core.rules import Pattern
@@ -739,10 +739,9 @@ def apply(self, eqs, vars, evaluation):
739739
sympy_eqs = []
740740
sympy_denoms = []
741741
for eq in eqs:
742-
symbol_name = eq.get_name()
743-
if symbol_name == 'System`True':
742+
if eq == SymbolTrue:
744743
pass
745-
elif symbol_name == 'System`False':
744+
elif eq == SymbolFalse:
746745
return Expression('List')
747746
elif not eq.has_form('Equal', 2):
748747
return evaluation.message('Solve', 'eqf', eqs_original)

mathics/builtin/combinatorial.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sympy
99

1010
from mathics.builtin.base import Builtin
11-
from mathics.core.expression import Expression, Integer, Symbol
11+
from mathics.core.expression import Expression, Integer, Symbol, SymbolTrue, SymbolFalse
1212
from mathics.builtin.arithmetic import _MPMathFunction
1313
from itertools import combinations
1414

@@ -120,10 +120,9 @@ def generate():
120120
else:
121121
raise _NoBoolVector
122122
elif isinstance(leaf, Symbol):
123-
name = leaf.name
124-
if name == 'System`True':
123+
if leaf == SymbolTrue:
125124
yield 1
126-
elif name == 'System`False':
125+
elif leaf == SymbolFalse:
127126
yield 0
128127
else:
129128
raise _NoBoolVector

0 commit comments

Comments
 (0)