def visit_ListComp(self, node): result = self.block.alloc_temp() gen_node = ast.GeneratorExp( elt=node.elt, generators=node.generators, loc=node.loc) with self.visit(gen_node) as gen: self.writer.write_checked_call2( result, 'πg.ListType.Call(πF, πg.Args{{{}}}, nil)', gen.expr) return result
def visit_DictComp(self, node): result = self.block.alloc_temp() elt = ast.Tuple(elts=[node.key, node.value]) gen_node = ast.GeneratorExp( elt=elt, generators=node.generators, loc=node.loc) with self.visit(gen_node) as gen: self.writer.write_checked_call2( result, 'πg.DictType.Call(πF, πg.Args{{{}}}, nil)', gen.expr) return result