privacy in Python

Erno Kuusela erno-news at erno.iki.fi
Wed Aug 29 10:25:48 EDT 2001


In article <39ce62b8.0108290610.42e6a3b0 at posting.google.com>,
ens_z at yahoo.com (Ens) writes:

| 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.

like in most languages (eg java and c++), "private" in python is not
meant to provide data security against malicious users - one
can get around it if he knows how it works behind the scenes.

  -- erno



More information about the Python-list mailing list