pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

E721: suggest reasonable alternative

Open Kaligule opened this issue 7 years ago • 12 comments

E721 is there to prevent type(3) == int in favour of isinstance(3, int). Thats fine.

But it also raises an error for code like type(a) == type(b). This is good code though and I don't know of a better way to test if two values have the same type. Of course you can go for isinstance(a, type(b)), but that is longer and less readable.

I suggest either changing E721 to not match lines like the above or to suggest a reasonable alternative to the line above.

Kaligule avatar Aug 23 '19 12:08 Kaligule