Skip to content

Support bare Callable types #670

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

Closed
ghost opened this issue May 13, 2015 · 3 comments
Closed

Support bare Callable types #670

ghost opened this issue May 13, 2015 · 3 comments
Assignees
Labels
bug mypy got something wrong topic-pep-484

Comments

@ghost
Copy link

ghost commented May 13, 2015

from typing import Iterable, TypeVar, Callable, Iterator, Generic

T = TypeVar("T")

def gen(f: Callable, *args) -> Callable[[], Iterator[T]]:
    return lambda: f(*args)

Related question: is it currently possible to type argument f: Callable[..., Iterator[T]]?

@JukkaL JukkaL added the bug mypy got something wrong label May 14, 2015
@JukkaL
Copy link
Collaborator

JukkaL commented May 14, 2015

Hmm, I don't think that PEP 484 says that Callable is a valid type, but mypy shouldn't crash when you try to use it. It should give an error.

Answer to the question: not yet, but it will become possible: #393

@JukkaL
Copy link
Collaborator

JukkaL commented Jun 1, 2015

PEP 484 actually supports using Callable as a type, so mypy should support as well.

@JukkaL JukkaL added the priority label Jun 1, 2015
@JukkaL JukkaL changed the title This code raises an exception on type-check Support bare Callable types Jun 1, 2015
@JukkaL
Copy link
Collaborator

JukkaL commented Jun 1, 2015

Callable should be equivalent to Callable[..., Any].

@ddfisher ddfisher added this to the 0.3.2 milestone Mar 2, 2016
@gnprice gnprice removed the priority label Mar 2, 2016
@ddfisher ddfisher self-assigned this Mar 2, 2016
ddfisher added a commit to ddfisher/mypy that referenced this issue Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-pep-484
Projects
None yet
Development

No branches or pull requests

3 participants