Why self?

- c o v e n t r y - coventry at removethisandallhyphens-o-n-e.net
Thu Jul 11 19:16:05 EDT 2002


No, you are only using a convention to let other developers know
that these variables are private - the python interpreter does not
even attempt to hide a '__' variable from other classes or code.
Private members are by convention only in python, they are not
enforced, thus you do not realistically get a similar result.


>>Only 2 'extra' chars are needed -- a letter and '.'.  Why the extra
>>'__'?
>>
> 
> Thy're "private" instance variables.  Whereas other languages
> provide a declaration for such a propterty, you get a similar
> result in Python by mangling the name...
> 
> 




More information about the Python-list mailing list