global or not global?
Justin Sheehy
dworkin at ccs.neu.edu
Fri May 26 16:54:25 EDT 2000
More information about the Python-list mailing list
Fri May 26 16:54:25 EDT 2000
- Previous message (by thread): Open Mind
- Next message (by thread): global or not global?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Ralf Claus" <ralf.claus at t-online.de> writes: > class any(): > > def what(): > > def this(): > > def unknown(): > > How can i define a variable, they could change in all this functions? > And all functions must be read this variable! Just an example, using your class and method names: class any: def __init__(self): self.spam = 0 def what(self): print self.spam def this(self): self.spam = self.spam + 1 def unknown(self): self.spam = 0 To understand the use of 'self' there, read the standard Python documentation, especially the sections on classes. The tutorial is a good place to start. -Justin
- Previous message (by thread): Open Mind
- Next message (by thread): global or not global?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list