You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like it doesn't have anything to do with the unpacking; it seems to pertain to the handling of ast.FormattedValue. Mypy handles this correctly:
If the string contains a single formatting field and nothing else the node can be isolated otherwise it appears in JoinedStr.
In this most recent example, using an fstring with tokens besides the formatted value produces a JoinedStr token. Maybe mypy handles JoinedStr correctly but not FormattedValue?
Activity
ns-cweber commentedon May 19, 2017
Strangely, this is fine:
... but this is not:
So it seems like it's the unpacking syntax (
... for x, y in ...) that makes the difference, and not whether or not the iterator type is primitive.[-]Incorrect errors for new fstrings[/-][+]Incorrect errors for fstrings + generators[/+]ns-cweber commentedon May 19, 2017
It looks like it doesn't have anything to do with the unpacking; it seems to pertain to the handling of
ast.FormattedValue. Mypy handles this correctly:According to GreenTreeSnakes' FormattedValue docs:
In this most recent example, using an fstring with tokens besides the formatted value produces a JoinedStr token. Maybe mypy handles JoinedStr correctly but not FormattedValue?
JelleZijlstra commentedon May 19, 2017
Yes, it looks like the bug is that mypy interprets
f"{x}"as having the type ofx.Parse each format-string component separately
Parse each format-string component separately
Parse each format-string component separately (#3390)