-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Bare Tuple
should mean Tuple[Any, ...]
.
#2185
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
Conversation
def f(a: Tuple) -> None: pass | ||
f(()) | ||
f((1,)) | ||
f(('', '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call with a non-tuple argument such as an int.
Ouch. I just realized that I broke the behavior of |
@JukkaL Another look? I added the test with int you requested, and fixed the issue I introduced with I also looked into the difference with the next block and decided to leave that alone (although reducing it to |
If I understand correctly, this flag may be useful in order to write |
Sorry, Union[](like Tuple[]) is invalid syntax. We use Tuple[()] as an |
from typing import Tuple | ||
def f(a: Tuple[()]) -> None: pass | ||
f(()) | ||
f((1,)) # E: Argument 1 to "f" has incompatible type "Tuple[int]"; expected "Tuple[]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe update the output
8000
of an empty tuple to be Tuple[()]
instead of Tuple[]
?
Other than the comment above, this looks good to me. |
About Tuple[] vs. Tuple[()] in output... I have the patch for that ready, |
OK, sounds reasonable |
Fix #2184. (See also python/typing#284.)