Support variadic tuple packing/unpacking #16205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is includes also related things such as tuple concatenation, special-cased tuple "re-packing", and star tuple unpacking in homogeneous collections.
It looks like we are very close to the finish line (the only major missing feature is type narrowing using
len()
, apart from this I just need to do couple technical things, and make one final search for missed code paths).Some notes:
list[object]
is the best type we can have.(x, *y, z)
, wherey
is saytuple[int, ...]
. This may cause errors for code that previously worked (when we will turn this feature on). For example(1, *[], 2)[42]
will be an error. As usual, I propose to try to be strict, and relax if people will complain (FWIW, I expect very few false positives from this).Unpack
can now "leak" if it was never used explicitly. This is not the case, it is just that experimental features are enabled in tests.Any
-like l.h.s types after an error in tuple unpacking (when needed) to avoid extra "Cannot determine type" errors in my tests.@mehdigmira If you are still not tired doing this, please check this PR as usual.