Skip to content

Wrong typing warning for map. (Argument X to "map" has incompatible type overloaded function) #6811

Open
@y9c

Description

@y9c

I write this function to check the rightmost common element of two list.

this is the code.

import itertools

def get_common_index(*names: str) -> int:
    """zip genalogy history name tag."""

    return max(
        i
        for i, x in enumerate(
            map(
                lambda x: len(set(x)) > 1,
                list(reversed(list(itertools.zip_longest(*map(reversed, names), fillvalue="0")))),
            )
        )
        if x
    )

print(get_common_index("1110111111", "101101111")

It works fine, and the input types are correct.

$ python test.py

5

But mypy raise the following error message.

$ mypy test.py

test.py:24: error: Argument 1 to "map" has incompatible type overloaded function; expected "Callable[[str], Iterator[_T]]"

Is this an error of mypy?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions