I am not entirely sure whether or not this behavior is to be expected or not, but it is definitely quite strange. When you have some code like this:
def a_function():
if a_list != some_other_list:
print(a_list)
It works fine and I had no issue with it. However, if you change it to:
def a_function():
if a_list != some_other_list:
a_list = some_other_list
Suddenly, a problem occurs where it says that a_list
on line 2 is an unresolved reference. Why should what is in the if statement affect whether a_list
can be resolved? Is this kind of thing normal? Is it perhaps a bug in Python 3.6.1 or PyCharm (Community Edition 2017.1.5)? Any help on clarifying this would be greatly appreciated.