@@ -1159,7 +1159,7 @@ def eval_multi(self, expr, first, sequ, evaluation):
11591159 return to_expression (name , to_expression (name , expr , * sequ ), first )
11601160
11611161
1162- class Operator (Builtin , ABC ):
1162+ class Operator (Builtin ):
11631163 """
11641164 Base Class for operators: binary, unary, nullary, prefix postfix, ...
11651165 """
@@ -1192,7 +1192,9 @@ def get_operator_display(self) -> Optional[str]:
11921192 return self .operator
11931193
11941194
1195- class InfixOperator (Operator , ABC ):
1195+ # Note: Metaprogramming in mathics.builtin.no_meaning fails if
1196+ # we inherit from ABC
1197+ class InfixOperator (Operator ):
11961198 """
11971199 Class for Mathics3 built-in Infix Operators. Infix operators are
11981200 represented with an operator in between each argument. A common
@@ -1254,14 +1256,14 @@ def __init__(self, *args, **kwargs):
12541256 self .rules = default_rules
12551257
12561258
1257- class NoMeaningInfixOperator (InfixOperator , ABC ):
1259+ class NoMeaningInfixOperator (InfixOperator ):
12581260 """
12591261 Operators that have no pre-defined meaning are derived from this class.
12601262 """
12611263
12621264 # This will be used to create a docstring
12631265 __doc_pattern__ = r"""
1264- {operator_name} <url>
1266+ <url>
12651267 :WML link:
12661268 https://reference.wolfram.com/language/ref/{operator_name}.html</url>
12671269
@@ -1277,6 +1279,13 @@ class NoMeaningInfixOperator(InfixOperator, ABC):
12771279 = a {operator_string} b
12781280
12791281 """
1282+ __formats_pattern__ = r"""{lbrace}
1283+ (
1284+ ("InputForm", "OutputForm", "StandardForm"),
1285+ f"{operator_name}[args__]",
1286+ ): (('Infix[{lbrace}args{rbrace}, {operator_string}"]'))
1287+ {rbrace}"""
1288+
12801289 attributes = A_NO_ATTRIBUTES
12811290 default_formats = False # Don't use any default format rules. Instead, see below.
12821291
@@ -1296,8 +1305,10 @@ def get_functions(self, prefix="eval", is_pymodule=False) -> List[Callable]:
12961305 return functions
12971306
12981307
1299- # Has to come before PostFixOperator and PrefixOperator
1300- class UnaryOperator (Operator , ABC ):
1308+ # Has to come before PostfixOperator and PrefixOperator
1309+ # Note: Metaprogramming in mathics.builtin.no_meaning fails if
1310+ # we inherit from ABC
1311+ class UnaryOperator (Operator ):
13011312 """
13021313 Class for Unary Operators, (e.g. Not, Factorial)
13031314 """
@@ -1321,7 +1332,9 @@ def __init__(self, format_function, *args, **kwargs):
13211332 self .formats [op_pattern ] = form
13221333
13231334
1324- class PostfixOperator (UnaryOperator , ABC ):
1335+ # Note: Metaprogramming in mathics.builtin.no_meaning fails if
1336+ # we inherit from ABC
1337+ class PostfixOperator (UnaryOperator ):
13251338 """
13261339 Class for Builtin Postfix Unary Operators, e.g. Factorial (!)
13271340 """
@@ -1330,7 +1343,40 @@ def __init__(self, *args, **kwargs):
13301343 super ().__init__ ("Postfix" , * args , ** kwargs )
13311344
13321345
1333- class PrefixOperator (UnaryOperator , ABC ):
1346+ # Has to be after PostfixOperator
1347+ class NoMeaningPostfixOperator (PostfixOperator ):
1348+ """
1349+ Postfix Operators that have no pre-defined meaning are derived from this class.
1350+ """
1351+
1352+ # This will be used to create a docstring
1353+ __doc_pattern__ = r"""
1354+ <url>
1355+ :WML link:
1356+ https://reference.wolfram.com/language/ref/{operator_name}.html</url>
1357+
1358+ <dl>
1359+ <dt>'{operator_name}[$x$]'
1360+ <dd>displays $x$ {operator_string}
1361+ </dl>
1362+
1363+ >> {operator_name}[x]
1364+ = x {operator_string}
1365+
1366+ >> x \[{operator_name}]
1367+ = x {operator_string}
1368+
1369+ """
1370+ attributes = A_NO_ATTRIBUTES
1371+ default_formats = False # Don't use any default format rules. Instead, see below.
1372+
1373+ operator = "This should be overwritten"
1374+ summary_text = "This should be overwritten"
1375+
1376+
1377+ # Note: Metaprogramming in mathics.builtin.no_meaning fails if
1378+ # we inherit from ABC
1379+ class PrefixOperator (UnaryOperator ):
13341380 """
13351381 Class for Builtin Prefix Unary Operators, e.g. Not ("¬")
13361382 """
@@ -1339,6 +1385,37 @@ def __init__(self, *args, **kwargs):
13391385 super ().__init__ ("Prefix" , * args , ** kwargs )
13401386
13411387
1388+ # Has to be after PrefixOperator
1389+ class NoMeaningPrefixOperator (PrefixOperator ):
1390+ """
1391+ Prefix Operators that have no pre-defined meaning are derived from this class.
1392+ """
1393+
1394+ # This will be used to create a docstring
1395+ __doc_pattern__ = r"""
1396+ <url>
1397+ :WML link:
1398+ https://reference.wolfram.com/language/ref/{operator_name}.html</url>
1399+
1400+ <dl>
1401+ <dt>'{operator_name}[$x$]'
1402+ <dd>displays {operator_string} $x$
1403+ </dl>
1404+
1405+ >> {operator_name}[x]
1406+ = {operator_string}x
1407+
1408+ >> \[{operator_name}]x
1409+ = {operator_string}x
1410+
1411+ """
1412+ attributes = A_NO_ATTRIBUTES
1413+ default_formats = False # Don't use any default format rules. Instead, see below.
1414+
1415+ operator = "This should be overwritten"
1416+ summary_text = "This should be overwritten"
1417+
1418+
13421419class PatternObject (BuiltinElement , BasePattern ):
13431420 needs_verbatim = True
13441421
0 commit comments