access private field in python 2.4

ajikoe at ajikoe at
Wed Jan 26 21:00:51 CET 2005

Hello, if we want to access the private member of object we use the
classname, it doesn't make sense. For example:
I have class A:

class A:
def __init__(self, i):
self.__i = i;

__i = 0

a = A(22);
b = A(33);

How can I get  field i in object a and how can I get field i in object
Beside I try to call:
print _A__i #fail  this create  error

Please help.
Pujo Aji

More information about the Python-list mailing list