Hi.
I'm writing some class, and decided to use inside private method and
some private variables. While with method i haven't got any problem's
with variables i have.
Maybe some example.
A class with private method and private variable:
"
>>> class Secret(object):
#
def __init__(self):
self._number = 1
#
def _secret(self):
print self._number
def showit(self):
print "Secret number is:\n"
self._secret()
>>> sec = Secret()
>>> sec.showit()
Secret number is:
1
>>> sec._number
1
>>> sec._number = 2
>>> sec._number
2
>>> sec._number += 3
>>> sec._number
5
>>>
"
As You can see, i made class with private method and private variable
inside __init__ constructor. I've changed also the variable value, but
outside class.
I've got problem with changing some variable value _inside__my_ class,
which i'm writing.
I've searched over google, some tuts with topics about operations on
private variables, but didn't found anything - only how to make them,
but no how to assign new objects/override them with new content (and
other advanced and helpful options).
If someone could help me, it would be great.
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list