-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Unpacking starred expressions in tuples #7779
Comments
It looks like the issue is in This is a decent starter issue, maybe, if someone wants it. |
@msullivan I'd be happy to give this a shot |
Update: I added a test to
The test fails as expected. But now I'm stuck in |
Ok, I'm still learning about mypy internals but here's where I'm at: I can get an accurate type signature for the right hand side of assignment (even for silly examples with nested starred-expressions like I'm not sure if there's a more straightforward way of doing this. If it's obvious to anyone else, any hints as to what I'm missing would be appreciated. |
I'm not currently working on this anymore. Just mentioning this in case someone else wants to take it on. |
I would like to work on this issue. Any pointers to keep in mind? |
|
(migrated from a comment in #1178 at @ethanhs's request)
There seems to an issue with unpacking things when they are part of a tuple on the right side of assignment. #1178 is related, but specifically deals with variable-length tuples (and using
len()
to distinguish them). The current issue occurs even for fixed-length and type-annotated tuples.This results in incorrect inference about the tuple size (but Python does not complain, only mypy):
A workaround is to use cast(), as @JukkaL suggested:
And here's my versions of Python and mypy:
The text was updated successfully, but these errors were encountered: