28 Sep
2016
28 Sep
'16
5:55 p.m.
On 9/28/16 6:40 AM, Ben Elliston wrote:
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)? I agree with pylint here: your line is unidiomatic. That doesn't mean it's a bad line. Just add a pylint pragma. It's OK to know more about your code than pylint does.
--Ned.