I understand that to write the private / protected functions of the python module you use
def _func():
...
but I have a hierarchy of objects with specialized overrides. I also want to hide the internal implementation (since it is not intended to be used externally, and therefore I can hopefully improve it without breaking the code, and not that I think anyone will use it except me). If i use
class Paragraph(Tag):
def _method(self):
...
and try calling _method from another class that subclasses Tag IntelliJ IDEA (and probably pylint / other checkers as well) will give me a warning. Is there any way to fix this?
My use case is a set of markdown tag objects to create a tree structure that can be converted to the correct markdown line. Each tag overrides the protected method to transform itself and the tags that it contains, and some override the method for validating the subtag (for example, there are no embedded bold fonts). Only the top-level tag context has a public tree conversion method.
edit:
IntelliJ IDEA Warning:
access to the protected element of the _method class
source
share