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

Document that variable needs to be read for --allow-redefinition to work #6963

Closed
JukkaL opened this issue Jun 10, 2019 · 4 comments
Closed

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jun 10, 2019

See #6959.

Part of the motivation is that this shouldn't trigger redefinition:

x = None  # type: List[int]
...  # Do nothing with `x`
x = []  # Want to preserve type context
@Shivansh-khare
Copy link

I didn't get the issue can you tell in brief.

@terencehonles
Copy link
Contributor

terencehonles commented Feb 4, 2021

There look like there are other constraints that should be added where this is documented. Some quick examples is in a try/catch block, if a function is defined in the same scope #10016, and probably others can be pulled from https://github.com/python/mypy/blob/master/mypy/renaming.py

@ikonst
Copy link
Contributor

ikonst commented May 25, 2023

Current documentation says:

The variable must be used before it can be redefined:

Can we close this? @AlexWaygood

@AlexWaygood
Copy link
Member

Current documentation says:

The variable must be used before it can be redefined:

Can we close this? @AlexWaygood

Yup, fixed by @KotlinIsland in #11951! 🥳

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

No branches or pull requests

5 participants