diff --git a/doc/gotchas.rst b/doc/gotchas.rst index 176a07b15df1d1a6b6a4c925396147bc7ef97b1a..dc2b17e3322476055c177dafd7d9e1d8638ec0fa 100644 --- a/doc/gotchas.rst +++ b/doc/gotchas.rst @@ -13,3 +13,15 @@ order of 1000 intermediate arrays. Following remedies may be helpful: - Increasing the recursion limit via :func:`sys.setrecursionlimit`. - Checking for any broken memoization implementation in the sub-classed :class:`pytato.transform.Mapper`. + + +Traversal order in a :class:`pytato.transform.Mapper` +----------------------------------------------------- + +Although the direction of our DAG is similar to a data-flow graph, the +traversal order in mapper is the opposite way around i.e. the mapper method of +a node's user would be *entered* before the node's mapper method. However, the +mapper method of a node would be *returned* before it's user's mapper method is +returned. Similar traversal order is routinely seen in `visitors +<https://en.wikipedia.org/wiki/Visitor_pattern>`__ of other packages like +:mod:`pymbolic`, `pycparser <https://github.com/eliben/pycparser>`__, etc.