newbie-question: private attributes

T. Kaufmann merman at snafu.de
Tue Sep 17 10:20:50 EDT 2002


Hello everybody,

I know that Python has no modifiers like Java/ C++: keywords like private, public and so on.

What is the difference between the two attributes in this class?

class Test:

     def __init__(self):

         self.__var1 = 1 # I think this is a private attribute
         self._var2  = 2 # ... and this? Maybe protected?

Thanks for help.

o-o

Thomas




More information about the Python-list mailing list