From b8cbbc59c4a8acaa4b39d133f63ef062f8a799bc Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 19 Dec 2024 19:02:38 -0600 Subject: [PATCH] add questions/comments --- pytato/stringifier.py | 2 ++ pytato/transform/__init__.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pytato/stringifier.py b/pytato/stringifier.py index 952b8f8e2..709992ee4 100644 --- a/pytato/stringifier.py +++ b/pytato/stringifier.py @@ -72,7 +72,9 @@ def __init__(self, # Uses the same cache for both arrays and functions self._cache: dict[tuple[int, int], str] = {} + # Should expr be ArrayOrNames instead of Any? def rec(self, expr: Any, depth: int) -> str: + # Why cache by ID? cache_key = (id(expr), depth) try: return self._cache[cache_key] diff --git a/pytato/transform/__init__.py b/pytato/transform/__init__.py index b4be9aceb..504c9f818 100644 --- a/pytato/transform/__init__.py +++ b/pytato/transform/__init__.py @@ -324,6 +324,7 @@ class TransformMapper(CachedMapper[ArrayOrNames, FunctionDefinition, []]): implement default mapper methods; for that, see :class:`CopyMapper`. """ + # FIXME: This inflates recursion depth def rec_ary(self, expr: Array) -> Array: res = self.rec(expr) assert isinstance(res, Array) @@ -335,6 +336,7 @@ def rec_ary(self, expr: Array) -> Array: # {{{ TransformMapperWithExtraArgs class TransformMapperWithExtraArgs( + # Why multiple inheriting? CachedMapper[ArrayOrNames, FunctionDefinition, P], Mapper[ArrayOrNames, FunctionDefinition, P] ): @@ -345,6 +347,7 @@ class TransformMapperWithExtraArgs( The logic in :class:`TransformMapper` purposely does not take the extra arguments to keep the cost of its each call frame low. """ + # FIXME: This inflates recursion depth def rec_ary(self, expr: Array, *args: P.args, **kwargs: P.kwargs) -> Array: res = self.rec(expr, *args, **kwargs) assert isinstance(res, Array)