We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pyright calls it aliased conditional expression and we don't support it (yet?):
def func1(x: str | None): is_str = x is not None if is_str: reveal_type(x) # str else: reveal_type(x) # None
It occasionally comes up, and it would be handy to align expectations by mentioning it in the type narrowing docs.
Related, some users (e.g. #15332) expect even more complex analysis, which we should also clarify we don't do, and offer alternatives. For example:
a1: str | None a2: str | None if a1 is not None or a2 is not None: a: str = a1 or a2 else: raise ValueError
could be (reluctantly?) rewritten as:
a1: str | None a2: str | None a: str if a1 is not None: a = a1 elif a2 is not None: a = a2 else: raise ValueError
The text was updated successfully, but these errors were encountered:
Document we're not tracking relationships between symbols (#16018)
cc8a4b5
Fixes #15653. I did not use erictraut's "quantum entanglement" metaphor, though I find it to be quite illustrative :)
Successfully merging a pull request may close this issue.
pyright calls it aliased conditional expression and we don't support it (yet?):
It occasionally comes up, and it would be handy to align expectations by mentioning it in the type narrowing docs.
Related, some users (e.g. #15332) expect even more complex analysis, which we should also clarify we don't do, and offer alternatives. For example:
could be (reluctantly?) rewritten as:
The text was updated successfully, but these errors were encountered: