I understand that to write private/protected functions or methods, you use names with a leading underscore:
def _func():
...
but I have an object hierarchy with specialized overrides. Also, I want to hide the internal implementation (since it's not meant for outside use, and so I can hopefully improve it without breaking code). If I use
class Paragraph(Tag):
def _method(self):
...
and try calling _method from a different class that subclasses Tag, IntelliJ IDEA (and probably pylint/other checkers would also) gives me a warning:
access to a protected member of a class _method
Is there any way to fix this?
My use case is a set of markdown tag objects to generate a "Tree"-like structure that can be transformed into the correct markdown string. Each tag overrides a protected method to transform itself and the tags it contains and some override a method to check whether the sub-tags are valid (example no nested Bolds). Only the top level tag context has a public method to transform the tree.