Unbinding Variable Names
PyCharm doesn't seem to recognize that after a variable name has been unbound, referencing it would result in a NameError.
foo = 'bar'
del foo
print(foo)
Shouldn't PyCharm issue an "Unresolved reference 'foo'" warning on the third line?
I also have warnings in my project about "Shadowing names from outer scope" after the names have already been deleted from the namespace.
Please sign in to leave a comment.
Hi,
You are right, PyCharm's code inspection doesn't check if the object was deleted. If you think this to be a valuable feature, please feel free to create a feature request in our issue tracker:
https://youtrack.jetbrains.com/issues?q=project:pycharm
Thanks, I have created the feature request
https://youtrack.jetbrains.com/issue/PY-33475