![]() | There is no technical way of preventing users from manipulating data and methods in an object |
![]() | Convention: attributes and methods starting with an underscore are treated as non-public (``protected'') |
![]() | Names starting with a double underscore are considered strictly private (Python mangles class name with method name in this case: obj.__some has actually the name _obj__some) |
class MyClass: def __init__(self): self._a = False # non-public self.b = 0 # public self.__c = 0 # private