diff --git a/firedrake/assemble.py b/firedrake/assemble.py index 5802e76bf1..978fdc41a5 100644 --- a/firedrake/assemble.py +++ b/firedrake/assemble.py @@ -583,7 +583,8 @@ def update_tensor(assembled_base_form, tensor): raise NotImplementedError("Cannot update tensor of type %s" % type(tensor)) @staticmethod - def base_form_postorder_traversal(expr, visitor, visited={}): + def base_form_postorder_traversal(expr, visitor, visited=None): + visited = visited if visited is not None else {} if expr in visited: return visited[expr] @@ -605,7 +606,8 @@ def base_form_postorder_traversal(expr, visitor, visited={}): return visited[expr] @staticmethod - def base_form_preorder_traversal(expr, visitor, visited={}): + def base_form_preorder_traversal(expr, visitor, visited=None): + visited = visited if visited is not None else {} if expr in visited: return visited[expr]