From 633e94ba3ca78ddab2c641d9b6419ef262e8608e Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 26 Aug 2025 06:19:38 -0400 Subject: [PATCH] Shorten TraceEvaluation Lines of the form: Replacing: x -> x don't add anything, so remove them. In the future, maybe we can have a "verbosity level" to include something like this. The only purpose I can see, is to indicate that a rewrite rule was considered and did nothing. However, TraceEvaluations are typically very long and in my experience doesn't add clarity, just clutter. --- mathics/eval/tracing.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mathics/eval/tracing.py b/mathics/eval/tracing.py index 11fee0593..55ba37bc7 100644 --- a/mathics/eval/tracing.py +++ b/mathics/eval/tracing.py @@ -122,7 +122,10 @@ def print_evaluate(expr, evaluation, status: str, fn: Callable, orig_expr=None): expr = expr[0] elif not evaluation.definitions.trace_evaluation: return - evaluation.print_out(f"{indents}{status}: {orig_expr} = " + str(expr)) + expr_str = str(expr) + if status == "Replacing" and orig_expr == expr_str: + return + evaluation.print_out(f"{indents}{status}: {orig_expr} = {expr_str}") elif not is_performing_rewrite(fn): if not evaluation.definitions.trace_evaluation: