-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add type for variable-length tuples #184
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
Comments
PEP 484 draft uses It will also work in Python 2. |
There are still some corner cases that aren't handled properly, but I pushed the implementation as it's good enough for many uses already. |
Now to change all the stubs ... |
I updated some obvious stub definitions already ( |
We should have a type for variable-length tuples. It could be called
TupleSequence[T]
.Example:
It is needed for precise static typing of some builtins, such as
str.startswith
.We would not (generally) infer these types automatically for variables: type inference would still produce
Tuple[...]
types.Update: Actually, it seems more reasonable to have Tuple[...] as a subtype of TupleSequence[...] assuming type arguments are compatible. Also need to update type joins to handle these.
EDIT: Update to conform to the actual syntax.
The text was updated successfully, but these errors were encountered: