A question of variables
mal at lemburg.com
Fri Aug 20 10:04:17 CEST 1999
Carlos Ors wrote:
> How can I declare a variable as a private variable inside a method of a
All variables defined inside a method of a class are private to
that method except ones declared global with the global statement.
The same applies to functions.
"Private" instance attributes can be created using the __XXX
convention, e.g. self.__privatevar = 1. These are only
useable for methods defined in the same class, not for methods
defined in subclasses.
Y2000: 133 days left
Python Pages: http://www.lemburg.com/python/
More information about the Python-list