About Encapsulation
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Wed May 4 18:34:24 EDT 2005
Adriano Monteiro a écrit :
> Hey folks,
>
> I wanna know more about encapsulation in python. Is it fully suported?
> How can I define the encapsulation statements for methods and attributes?
If you're thinking of things like private/protected/public:
class Foo(object):
def __init__(self):
self.public = 'this is the API'
self._protected = 'implementation detail'
self.__private = 'keep out'
BTW, you may want to have a look at this:
http://c2.com/cgi/wiki?EncapsulationIsNotInformationHiding
More information about the Python-list
mailing list