basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

`redundant-expr` doesn't work on `isinstance` unless it's a variable

Open DetachHead opened this issue 1 year ago • 1 comments

Describe the problem, ie expected/actual result (if it's not blatantly obvious)

No response

Gist to reproduce

# mypy: enable-error-code=redundant-expr

if isinstance(1, str): # no error
    ...
    
b = 1    
if isinstance(b, str): # error
    ...

DetachHead avatar Jan 12 '24 01:01 DetachHead

  • upstream: https://github.com/python/mypy/issues/16769

KotlinIsland avatar Jan 12 '24 01:01 KotlinIsland