Dnia niedziela, 25 czerwca 2006 22:45, Bob Gailer napisaĆ: > To get the behavior I think you want try: > > def __init__(self, q = None): > if not q: q = [] > self.queue = q
I would disagree... This sure works for empty arguments, but: >>> u = [1,2,3] >>> a = Queue(u) >>> b = Queue(u) >>> a.insert(12) >>> print b gives [1, 2, 3, 12] which is still wrong. However assigning self.queue a COPY of parameter (empty or not) gives the desired result: def __init__(self, q = []): self.queue = q[:] -- Pawel Kraszewski _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor