[python] avoid "Void should be Dynamic" in Syntax.foreach