-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
PEP 572: Type not narrowed correctly in assignment #7316
Labels
Comments
JelleZijlstra
added
bug
mypy got something wrong
priority-1-normal
topic-pep-572
PEP 572 (walrus operator)
labels
Aug 10, 2019
This was referenced Nov 22, 2019
This is actually pretty important to support, this example: discount = 0.0
if (mo := re.search(r'(\d+)% discount', advertisement)):
discount = float(mo.group(1)) / 100.0 is the flagship example taken from Python 3.8 What's New, and is actually the prime use case for assignment expressions in general. Raising priority to high. |
hauntsaninja
pushed a commit
to hauntsaninja/mypy
that referenced
this issue
Jan 8, 2020
msullivan
pushed a commit
that referenced
this issue
Jan 8, 2020
davep
added a commit
to davep/journeys.py
that referenced
this issue
Jan 30, 2020
Note that, as of the time of writing, straightforward type checks are fine, but strict checking still fails due to python/mypy#7316
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Example from @gvanrossum in #6899:
The text was updated successfully, but these errors were encountered: