Use of variables form outside the class.
Ralph Gauges
ralph.gauges at eml.villa-bosch.de
Thu Jul 29 10:37:33 EDT 1999
More information about the Python-list mailing list
Thu Jul 29 10:37:33 EDT 1999
- Previous message (by thread): Use of variables form outside the class.
- Next message (by thread): ANN: mxTextTools Package - Version 1.1.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Oleg Broytmann wrote: > > On Thu, 29 Jul 1999, Peter Torstenson wrote: > > I declare a variable "x" right in the beginning of a module. > > Later I declare a class with function defs. > > I managed to declare varibles inside the class and address them by putting > > "self." in front of the variable. > > How do I reach the "x" variable that is outside any class from inside the > > class functions? > > x = 1 > > class X > def set_x(self): > self.x = 2 > > def set_global_x(self): > global x > x = 2 > > > Peter Thorstenson > > The Newbie > > Oleg. > ---- > Oleg Broytmann Netskate/Inter.Net.Ru phd at emerald.netskate.ru > Programmers don't die, they just GOSUB without RETURN. I guess I should read more carefully. I thought you were defining the variable inside the class, but outside the methods. Sorry for the wrong answer. Olegs answer is the right one. Ralph
- Previous message (by thread): Use of variables form outside the class.
- Next message (by thread): ANN: mxTextTools Package - Version 1.1.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list