Skip to content

Function is a misleading name for Callable #394

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
abarnert opened this issue Aug 17, 2014 · 4 comments
Closed

Function is a misleading name for Callable #394

abarnert opened this issue Aug 17, 2014 · 4 comments

Comments

@abarnert
Copy link

The thing that matches collections.abc.Sequence is called Sequence, while the thing that matches the concrete type tuple is called Tuple. And the same goes for almost every type in typing.py.

The one exception is that the thing that matches collections.abc.Callable is called Function, even though it matches methods, objects with __call__ methods, builtins, etc., not just functions. Why isn't this called Callable, while Function is the generic version of types.FunctionType?

@JukkaL
Copy link
Collaborator

JukkaL commented Aug 17, 2014

I'm not aware of any great reason for calling it Function. Before mypy switched to a Python-compatible syntax it used func<...> for callable types, and Function is derived from the old syntax. I'm fine with changing the name to Callable unless somebody convincingly argues for keeping the current naming.

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 21, 2014

Okay, I'm convinced that typing.Function should be renamed to typing.Callable.

See also discussion here: https://github.com/JukkaL/typing/issues/2

@JukkaL
Copy link
Collaborator

JukkaL commented Jan 17, 2015

The PEP 484 draft uses Callable: python/typing#5

@JukkaL
Copy link
Collaborator

JukkaL commented Jan 25, 2015

Renamed typing.Function to typing.Callable in commit 0897a6c.

@JukkaL JukkaL closed this as completed Jan 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants