Skip to content

False positive error? #5835

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

Closed
oriontvv opened this issue Oct 24, 2018 · 1 comment
Closed

False positive error? #5835

oriontvv opened this issue Oct 24, 2018 · 1 comment

Comments

@oriontvv
Copy link

oriontvv commented Oct 24, 2018

I see error for code:

def func(choice: str, default: str='y') -> bool:
    values = ('yes', '') if default == 'y' else ('yes',) # error: Unsupported right operand type for in ("object")
    # values = ('yes', '') if True else ('yes',) # ok (!)
    return choice in values

Is it a bug? mypy version is 0.641

@ilevkivskyi
Copy link
Member

This is a known bug, duplicate of #4975.

Workaround is to use lists instead of tuples (or use # type: ignore on that line to silence mypy).

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

No branches or pull requests

2 participants