I can't get the value of the variable (out of the class function) if it has
two leading underscores.

-Dave

>>> class encrypt:
 def encrypt(self, userValue):
  self.initialNumber = userValue
  self.__secretSeed = 7
  return self.initialNumber * self.__secretSeed

>>> enc = encrypt()
>>> enc.encrypt(5)
35
>>> print enc.initialNumber
5
>>> print enc.__secretSeed

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in -toplevel-
    print enc.__secretSeed
AttributeError: encrypt instance has no attribute '__secretSeed'



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to