compiler.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:tailbiter 作者: darius 项目源码 文件源码
def visit_ListComp(self, t):
        result_append = ast.Attribute(ast.Name('.0', load), 'append', load)
        body = ast.Expr(Call(result_append, [t.elt]))
        for loop in reversed(t.generators):
            for test in reversed(loop.ifs):
                body = ast.If(test, [body], [])
            body = ast.For(loop.target, loop.iter, [body], [])
        fn = [body,
              ast.Return(ast.Name('.0', load))]
        args = ast.arguments([ast.arg('.0', None)], None, [], None, [], [])
        return Call(Function('<listcomp>', args, fn),
                    [ast.List([], load)])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号