Pylint W0212 protected-access

Christian Geier is right about why you're getting the error, and how to disable it.

I'd encourage you to consider changing your code, though: pylint is telling you something important. From your example code looks like you want to use eq compare objects of class A to other objects of class A, but your example won't guarantee that a caller won't try A() == C(). Returning True when you check Circle()._radius == Sphere._radius seems likely to cause problems.

See this stackoverflow thread for discussion of how to handle this.


pylint doesn't know of which type other is (how should it, you can compare an instance of A to everything), therefore the warning. I don't think there is a way around disabling the warning.

You can disable the warning for only that one line with appending # pylint: disable=W0212 to that line.