Back to Intellij Community

PyProtectedMemberInspection

python/python-psi-impl/resources/inspectionDescriptions/PyProtectedMemberInspection.html

2025.3-rc-2355 B
Original Source

Reports cases when a protected member is accessed outside the class, a descendant of the class where it is defined, or a module.

Example:

class Foo:
    def _protected_method(self):
        pass

class Bar(Foo):
    def public_method(self):
        self._protected_method()

foo = Foo()
foo._protected_method() # Access to a protected method