Python does not support access protection as C++/Java/C# does. Everything is public. The motto is, “We’re all adults here.” Document your classes, and insist that your collaborators read and follow the documentation.
The culture in Python is that names starting with underscores mean, “don’t use these unless you really know you should.” You might choose to begin your “protected” methods with underscores. But keep in mind, this is just a convention, it doesn’t change how the method can be accessed.
Names beginning with double underscores (__name
) are mangled, so that inheritance hierarchies can be built without fear of name collisions. Some people use these for “private” methods, but again, it doesn’t change how the method can be accessed.
The best strategy is to get used to a model where all the code in a single process has to be written to get along.