_string.py 文件源码

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

项目:tidy 作者: cyrus- 项目源码 文件源码
def _is_None(node):
    #
    # for some reason, 
    #
    #   > ast.dump(ast.parse(x[0:1:]))
    #   Module(body=[Expr(value=Subscript(value=Name(id='x', ctx=Load()), 
    #       slice=Slice(lower=Num(n=0), upper=None, 
    #       step=Name(id='None', ctx=Load())), ctx=Load()))])
    #
    # notice that the step value is not 'None' but the Name that contains 'None'. 
    # Need to special case this.
    #
    return node is None or (isinstance(node, ast.Name) and node.id == 'None')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号