diff --git a/python/dune/perftool/ufl/visitor.py b/python/dune/perftool/ufl/visitor.py
index 4fe8cf65942a3921f12d36355099efa7489be268..b4283031662228c785235c4e5f69fd21f032c0e9 100644
--- a/python/dune/perftool/ufl/visitor.py
+++ b/python/dune/perftool/ufl/visitor.py
@@ -309,7 +309,7 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker):
 
     def _minmax_impl(self, python_func, c_func, children):
         # Build the maximum of those that are constant
-        constants = filter(lambda i: isinstance(i, (float, int)), children)
+        constants = list(filter(lambda i: isinstance(i, (float, int)), children))
         children = set(filter(lambda i: not isinstance(i, (float, int)), children))
 
         if constants: