[code-quality] false positive for unidiomatic-typecheck?

Ben Elliston bje at air.net.au
Wed Sep 28 06:40:13 EDT 2016


I am seeing the following message from pylint:

foo.py:311: [C0123(unidiomatic-typecheck), _legend] Using type() instead of isinstance() for a typecheck.

My line is:
            if type(g) not in unique:

That is, I am maintaing a list of unique types in a set of objects.
This isn't a typecheck.  Shouldn't the warning only be produced when
type(x) is compared with type(y)?

Thanks, Ben


More information about the code-quality mailing list