access-modifiers

Protected method in python

Protected method in python Question: Possible Duplicate: Making a method private in a python subclass Private Variables and Methods in Python How can I define a method in a python class that is protected and only subclasses can see it? This is my code: class BaseType(Model): def __init__(self): Model.__init__(self, self.__defaults()) def __defaults(self): return {‘name’: {}, …

Total answers: 2

"Private" (implementation) class in Python

"Private" (implementation) class in Python Question: I am coding a small Python module composed of two parts: some functions defining a public interface, an implementation class used by the above functions, but which is not meaningful outside the module. At first, I decided to “hide” this implementation class by defining it inside the function using …

Total answers: 9