privacy in Python

Joal Heagney s713221 at student.gu.edu.au
Wed Aug 29 16:20:34 CEST 2001


Ens wrote:
> 
> class cls:
>         def f(self, a, b):
>                 print a+b
>         __p=12
> 
> obj=cls()
> fun=obj.f
> print fun.im_self._cls__p
> 
> 12
> 
> I need that '__p' exactly be private.

If this is for security reasons, you may not be able to manage that in
python (I.e. my hint to you to wait for the responses of more
knowledgable pythoneers.), but have a look at the Bastion and rexec
modules.
-- 
      Joal Heagney is: _____           _____
   /\ _     __   __ _    |     | _  ___  |
  /__\|\  ||   ||__ |\  || |___|/_\|___] |
 /    \ \_||__ ||___| \_|! |   |   \   \ !



More information about the Python-list mailing list