小编Ing*_*soc的帖子

Python 中未解析的列表引用

我不完全确定这种行为是否符合预期,但这绝对是很奇怪的。当你有这样的代码时:

def a_function():
    if a_list != some_other_list:
        print(a_list)
Run Code Online (Sandbox Code Playgroud)

它工作得很好,我没有遇到任何问题。但是,如果将其更改为:

def a_function():
    if a_list != some_other_list:
        a_list = some_other_list
Run Code Online (Sandbox Code Playgroud)

突然,出现了一个问题,提示a_list第 2 行是未解析的引用。为什么if语句中的内容会影响能否a_list解决呢?这种事情正常吗?这可能是 Python 3.6.1 或 PyCharm(社区版 2017.1.5)中的错误吗?任何澄清这一点的帮助将不胜感激。

python debugging function pycharm

2
推荐指数
1
解决办法
1986
查看次数

标签 统计

debugging ×1

function ×1

pycharm ×1

python ×1