OO Bug needs squashing

Paul Rubin http
Mon Apr 12 18:48:34 EDT 2004


billybugmaster at yahoo.com (nick) writes:

> class Day:
> 	name = None
> 	events = []
> 	eventD = {}

I think you mean:

    class Day:
       def __init__(self):
          self.name = None
          self.events = []
          self.eventD = {}

and similarly for the Event class.

That creates those attributes in each newly-created instance.  The way
you have it, it makes attributes on the entire class, not separately
for each instance.



More information about the Python-list mailing list