From a801896797fc6b332e7e710f405ec474987b67a4 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 27 Aug 2024 08:52:39 -0400 Subject: [PATCH] Go over comments... * Correct and expand comment regarding trace.run_xxx * And one other comment in trace_fn_call_event --- mathics/core/builtin.py | 12 ++++++++---- mathics/core/symbols.py | 7 ++++--- mathics/eval/tracing.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mathics/core/builtin.py b/mathics/core/builtin.py index 2f80d4ab8..e4a47ff16 100644 --- a/mathics/core/builtin.py +++ b/mathics/core/builtin.py @@ -10,7 +10,7 @@ import os.path as osp import re from abc import ABC -from functools import lru_cache, total_ordering +from functools import total_ordering from itertools import chain from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union, cast @@ -18,9 +18,13 @@ import pkg_resources import sympy -# Note: it is important *not* use: from mathics.eval.tracing import run_sympy -# but instead import the module and access below as tracing.run_sympy. -# This allows us change where tracing.run_sympy points at runtime. +# Note: it is important *not* to use: +# from mathics.eval.tracing import run_sympy +# but, instead, import the module, as below, and then +# access ``run_sympy`` using ``tracing.run_sympy.`` +# +# This allows us to change where ``tracing.run_sympy`` points to at +# run time. import mathics.eval.tracing as tracing from mathics.core.atoms import ( Integer, diff --git a/mathics/core/symbols.py b/mathics/core/symbols.py index b01b7bc61..193231d3b 100644 --- a/mathics/core/symbols.py +++ b/mathics/core/symbols.py @@ -14,9 +14,10 @@ # I put this constants here instead of inside `mathics.core.convert.sympy` # to avoid a circular reference. Maybe they should be in its own module. -# Prefix used for Sympy variables. -# We wan t this to be short to keep variable names short. -# In tracing values, long names make output messy. +# Prefix used for Sympy variables. We want prefixes to be short to +# keep variable names short. In tracing values, long names makes +# output messy and harder to follow, since it detracts from the +# important information sympy_symbol_prefix = "_u" sympy_slot_prefix = "_#" diff --git a/mathics/eval/tracing.py b/mathics/eval/tracing.py index e1716bb40..7dc2d6907 100644 --- a/mathics/eval/tracing.py +++ b/mathics/eval/tracing.py @@ -18,7 +18,7 @@ def trace_fn_call_event(func: Callable) -> Callable: """ - Wrap a a call event with callbacks + Wrap a call event with callbacks, so we can track what happened before the call and the result returned by the call.