Skip to content

Generic function type argument inference problem #230

Closed
@JukkaL

Description

@JukkaL

The type checker can't infer the type argument in the call to f below, even though there seems to be no reason why it shouldn't be able to do it:

from typing import List, TypeVar
T = TypeVar('T')
def f(a: List[T], b: List[T]) -> None: pass
x = ['']
f(x, [])  # Cannot infer type argument 1 of "f"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions