We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
python
Learn more about funding links in repositories.
Report abuse
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
This code doesn't generate errors:
class A: y = False a = None # type: object (a.y for a in [A()])
However, this generates (just added isinstance):
isinstance
class A: y = False a = None # type: object if isinstance(a, int): pass # only difference (a.y for a in [A()])
Output is like this:
program.py:7: error: "object" has no attribute "y"
The latter program shouldn't generate any error. There seems to be some weird interaction between isinstance and generator scoping.
The text was updated successfully, but these errors were encountered:
Ah, the type in the conditional type binder probably gets propagated to the generator even though that variable there is in a different scope.
Sorry, something went wrong.
The second example works fine at least in 0.510, so Im closing this.
No branches or pull requests
This code doesn't generate errors:
However, this generates (just added
isinstance
):Output is like this:
The latter program shouldn't generate any error. There seems to be some weird interaction between
isinstance
and generator scoping.The text was updated successfully, but these errors were encountered: