import compiler import ast def process(node): dest = ast.nextPRegister() ast.outputInBlock( "%s = new %s" % ( dest, "PyList" ) ) for x in node.quals: if x.__class__ == compiler.ast.ListCompFor: getattr(getattr(__import__("ast.ListCompFor"),"ListCompFor"),"processComprehension")( x, dest, node.expr ) if x.__class__ == compiler.ast.ListCompIf: getattr(getattr(__import__("ast.ListCompIf"),"ListCompIf"),"processComprehension")( x, dest, node.expr ) return dest