[Tutor] constructors

Remco Gerlich scarblac@pino.selwerd.nl
Wed, 10 Apr 2002 11:52:01 +0200


On  0, Alexandre Ratti <alex@gabuzomeu.net> wrote:
> Example:
> 
> class Foo:
>          """Just a silly class."""
> 
>          def __init__(self):
>                  """Initialise the class."""
>                  theList = []
> 
>          def addBar(self, bar):
>                  """Store bar."""
>                  # Here you do not need to test if theList exists.
>                  theList.append(bar)

Oops. You need to use 'self.theList' instead of just 'theList' in both
cases, the way you have it now won't work. Just a correction.

-- 
Remco Gerlich