Skip to content

callable is not documented in type narrowing section #11172

Closed
@sobolevn

Description

@sobolevn

https://mypy.readthedocs.io/en/latest/type_narrowing.html

Example:

from typing import Callable, Union

x: Union[int, Callable[[], int]]

if callable(x):
    reveal_type(x)  # N: Revealed type is "def () -> builtins.int"
else:
    reveal_type(x)  # N: Revealed type is "builtins.int"

Related #11088
Related #11150

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions