I am working with python for a short while and want to be clear on how to use python visibility properties such as objects and methods.
I know that
self.any
is going to be public
self._any
(an underscore) is going to be protected
self.__any
(double underscores) is going to be private
I can understand the meaning but I have one doubt in using self._any
Protected in PHP will be possible in only parent and child class where public is not.
But in python I can call protected from everywhere too.
Let say:
class Test(object):
def __init__(self)
self._any = 'Anything'
Test()._any # 'Anything'
Pls help explain this or give some examples regarding protected objects and methods.