Skip to content

Commit a4b609c

Browse files
committed
add questions/comments
1 parent 53a69ee commit a4b609c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pytato/stringifier.py

+2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def __init__(self,
7272
# Uses the same cache for both arrays and functions
7373
self._cache: dict[tuple[int, int], str] = {}
7474

75+
# Should expr be ArrayOrNames instead of Any?
7576
def rec(self, expr: Any, depth: int) -> str:
77+
# Why cache by ID?
7678
cache_key = (id(expr), depth)
7779
try:
7880
return self._cache[cache_key]

pytato/transform/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ class TransformMapper(CachedMapper[ArrayOrNames, FunctionDefinition, []]):
324324
implement default mapper methods; for that, see :class:`CopyMapper`.
325325
326326
"""
327+
# FIXME: This inflates recursion depth
327328
def rec_ary(self, expr: Array) -> Array:
328329
res = self.rec(expr)
329330
assert isinstance(res, Array)
@@ -335,6 +336,7 @@ def rec_ary(self, expr: Array) -> Array:
335336
# {{{ TransformMapperWithExtraArgs
336337

337338
class TransformMapperWithExtraArgs(
339+
# Why multiple inheriting?
338340
CachedMapper[ArrayOrNames, FunctionDefinition, P],
339341
Mapper[ArrayOrNames, FunctionDefinition, P]
340342
):
@@ -345,6 +347,7 @@ class TransformMapperWithExtraArgs(
345347
The logic in :class:`TransformMapper` purposely does not take the extra
346348
arguments to keep the cost of its each call frame low.
347349
"""
350+
# FIXME: This inflates recursion depth
348351
def rec_ary(self, expr: Array, *args: P.args, **kwargs: P.kwargs) -> Array:
349352
res = self.rec(expr, *args, **kwargs)
350353
assert isinstance(res, Array)

0 commit comments

Comments
 (0)