access private field in python 2.4
ajikoe at gmail.com
ajikoe at gmail.com
Wed Jan 26 15:00:51 EST 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;
pass
__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
b?
Beside I try to call:
print _A__i #fail this create error
Please help.
Pujo Aji
More information about the Python-list
mailing list