Skip to content

list('abc') not inferred to be of type List[str] #3395

Closed
@AbhijeetKrishnan

Description

@AbhijeetKrishnan

Reference: pandas-dev/pandas#29114 (comment)

list('abc') should be inferred to be of type List[str]. However, we still get errors if used as the argument to a function.

MRE -

import collections
named_tuple = collections.namedtuple('Test', list('abc'))

Running mypy on the above gives the error error: List or tuple literal expected as the second argument to namedtuple()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions