-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[feature request] Support ellipsis (...) like Callable when we want untyped arguments #1234
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
This seems pretty reasonable to me, and could be a good starter task for someone looking to get their hands dirty. Of the two proposed syntaxes, I'd vastly prefer the second one ( @gvanrossum would this require a change to PEP 484? |
(I'd actually love to jump on this task myself, once the powers that be give it the OK!) |
Yes, it would require a PEP change. But go ahead and make a PR. --Guido (mobile)
|
Here's a good place to start: https://github.com/python/mypy/blob/master/mypy/parse.py#L404 |
Note that in Python 3 this is already possible by omitting argument type annotations. For example:
This proposal brings Python 2 syntax closer to Python 3, which is good. Mixing annotated and unannotated arguments in a single function won't be supported for Python 2, but I'd argue that it's a marginal need. |
Agreed. Also, aren't unannotated arguments treated equivalently to arguments annotated with |
Yes, but I think the point of the feature request is that it would be
nice not to have to count how many Anys to put.
|
Right. I was just responding to Jukka's point about mixing annotated and unannotated arguments in a single function. |
I cross-filed this for PyCharm: https://youtrack.jetbrains.com/issue/PY-18598 |
And if python/typing#186 gets accepted, this would make the syntax even closer to the Python 3 syntax in terms of supported features. I assume that this would be okay:
|
Yes. --Guido (mobile)
|
Hi all,
It would be nice if MyPy supported a similar ellipsis notation to
typing.Callable
.From the typing docs,
It would be nice if MyPy supported something similar - i.e.
# type: ... -> ReturnType
or
# type: (...) -> ReturnType
Which would basically evaluate the same way as
# type: (Any, Any, Any, Any) -> ConcreteType
for a 4-argument function.The text was updated successfully, but these errors were encountered: