Skip to content

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

Closed
@AbhijeetKrishnan

Description

@AbhijeetKrishnan

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'))

Command used

mypy code.py

Version

mypy 0.720
Python 3.7.4

Actual output

error: List or tuple literal expected as the second argument to namedtuple().

Expected behaviour

I would expect it to succeed without error.

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

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