Skip to content

Commit e9db081

Browse files
committed
Note commutativity of Equal Uneqal UnsameQ in docs
Go over docs to remove extraneous and sometimes wrong information. Lint code
1 parent 3a6f9fd commit e9db081

2 files changed

Lines changed: 22 additions & 18 deletions

File tree

mathics/builtin/comparison.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from mathics.version import __version__ # noqa used in loading to check consistency.
55

6-
from typing import Optional, Union
6+
from typing import Optional
77

88
import sympy
99

@@ -16,7 +16,6 @@
1616
from mathics.builtin.constants import mp_convert_constant
1717

1818
from mathics.core.expression import (
19-
Atom,
2019
COMPARE_PREC,
2120
Complex,
2221
Expression,
@@ -44,9 +43,10 @@ def is_number(sympy_value) -> bool:
4443
class SameQ(BinaryOperator):
4544
"""
4645
<dl>
47-
<dt>'SameQ[$x$, $y$]'
48-
<dt>'$x$ === $y$'
49-
<dd>returns 'True' if $x$ and $y$ are structurally identical.
46+
<dt>'SameQ[$x$, $y$]'
47+
<dt>'$x$ === $y$'
48+
<dd>returns 'True' if $x$ and $y$ are structurally identical.
49+
Commutative properties apply, so if $x$ === $y$ then $y$ === $x$.
5050
</dl>
5151
5252
Any object is the same as itself:
@@ -74,9 +74,10 @@ def apply(self, lhs, rhs, evaluation):
7474
class UnsameQ(BinaryOperator):
7575
"""
7676
<dl>
77-
<dt>'UnsameQ[$x$, $y$]'
78-
<dt>'$x$ =!= $y$'
79-
<dd>returns 'True' if $x$ and $y$ are not structurally identical.
77+
<dt>'UnsameQ[$x$, $y$]'
78+
<dt>'$x$ =!= $y$'
79+
<dd>returns 'True' if $x$ and $y$ are not structurally identical.
80+
Commutative properties apply, so if $x$ =!= $y$, then $y$ =!= $x$.
8081
</dl>
8182
8283
>> a=!=a
@@ -528,12 +529,12 @@ def pairs(items):
528529
class Equal(_EqualityOperator, SympyComparison):
529530
"""
530531
<dl>
531-
<dt>'Equal[$x$, $y$]'
532+
<dt>'Equal[$x$, $y$]'
532533
<dt>'$x$ == $y$'
533-
<dd>yields 'True' if $x$ and $y$ are known to be equal, or
534-
'False' if $x$ and $y$ are known to be unequal.
535-
<dt>'$lhs$ == $rhs$'
536-
<dd>represents the equation $lhs$ = $rhs$.
534+
<dd>is 'True' if $x$ and $y$ are known to be equal, or
535+
'False' if $x$ and $y$ are known to be unequal, in which case
536+
case, 'Not[$x$ == $y$]' will be 'True'.
537+
Commutative properties apply, so if $x$ === $y$ then $y$ === $x$.
537538
</dl>
538539
539540
>> a==a
@@ -638,12 +639,12 @@ def _op(x):
638639
class Unequal(_EqualityOperator, SympyComparison):
639640
"""
640641
<dl>
641-
<dt>'Unequal[$x$, $y$]'
642-
<dt>'$x$ != $y$'
643-
<dd>yields 'False' if $x$ and $y$ are known to be equal, or
642+
<dt>'Unequal[$x$, $y$]'
643+
<dt>'$x$ != $y$'
644+
<dd>is 'False' if $x$ and $y$ are known to be equal, or
644645
'True' if $x$ and $y$ are known to be unequal.
645-
<dt>'$lhs$ == $rhs$'
646-
<dd>represents the inequality $lhs$ $rhs$.
646+
Commutative properties apply so if $x$ != $y$ then
647+
$y$ != $x$.
647648
</dl>
648649
649650
>> 1 != 1.

mathics/builtin/files.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,6 +2252,9 @@ class Get(PrefixOperator):
22522252
<dl>
22532253
<dt>'<<$name$'
22542254
<dd>reads a file and evaluates each expression, returning only the last one.
2255+
2256+
<dt>'Get[$name$, Trace->True]'
2257+
<dd>Runs Get tracing each line before it is evaluated.
22552258
</dl>
22562259
22572260
S> filename = $TemporaryDirectory <> "/example_file";

0 commit comments

Comments
 (0)