Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument 1 to "join" of "str" has incompatible type "Callable[[], List[str]]"; expected "Iterable[str]" #12110

Closed
willigott opened this issue Feb 1, 2022 · 2 comments
Labels
bug mypy got something wrong

Comments

@willigott
Copy link

Bug Report

I receive an unexpected error when running mypy related to a @classmethod exposed as @property of a class that inherits from Enum.

To Reproduce

from enum import Enum
from typing import List


class Stuff(Enum):
    A = 'something'
    B = 'something_else'
    C = 'even_more'
    
    @classmethod
    @property
    def important_stuff(cls) -> List[str]:
        return [cls.A.value, cls.C.value]


print(f'{", ".join(Stuff.important_stuff)}')

Expected Behavior

As important_stuff always returns a list of strings, I would not expect any error to occur.

Actual Behavior
I receive an error

error: Argument 1 to "join" of "str" has incompatible type "Callable[[], List[str]]"; expected "Iterable[str]"

Your Environment

  • Mypy version used: 0.910
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.9.5
  • Operating system and version: Ubuntu 20.04

The question was also asked on stackoverflow which also includes a workaround: click.

@willigott willigott added the bug mypy got something wrong label Feb 1, 2022
@soma2000-lang
Copy link

@jonshea I am workingon this

@hauntsaninja
Copy link
Collaborator

Duplicate of #11619 , note that CPython might remove support for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants