Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypy does not catch possibly undefined variables #2495

Closed
Dakkaron opened this issue Nov 24, 2016 · 1 comment
Closed

Mypy does not catch possibly undefined variables #2495

Dakkaron opened this issue Nov 24, 2016 · 1 comment

Comments

@Dakkaron
Copy link

Mypy does not catch variables that might not be defined due to ifs and therelike:

if False:
	a = "Test"

print(a)

This happens both in Python2- and Python3-mode
I remember in an earlier version I always had to define them before the if, so that the variables are always defined:

a = ""

if condition:
	a = "Test"

print(a)
@rwbarton
Copy link
Contributor

Duplicate of #2400.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants