statementlist.py 文件源码

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

项目:femtocode 作者: diana-hep 项目源码 文件源码
def buildexec(self):
        if isinstance(self.schema, Null):
            if sys.version_info[0] <= 2:
                return ast.Name("None", ast.Load())
            else:
                return ast.NameConstant(None)

        elif isinstance(self.schema, Boolean):
            if sys.version_info[0] <= 2:
                if self.value:
                    return ast.Name("True", ast.Load())
                else:
                    return ast.Name("False", ast.Load())
            else:
                if self.value:
                    return ast.NameConstant(True)
                else:
                    return ast.NameConstant(False)

        elif isinstance(self.schema, Number):
            return ast.Num(self.value)

        else:
            raise NotImplementedError   # have to think about this when the case comes up
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号