Bugs item #1549499, was opened at 2006-08-30 20:44 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1549499&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Thomas Dybdahl Ahle (thomasda) Assigned to: Nobody/Anonymous (nobody) Summary: bug in classlevel variabels Initial Comment: class A: js = [] def add (self, j): self.js.append(j) def clone (self): c = A() for j in self.js: c.add(j) return c a = A() b = a.clone() b.add(3) print a.js print b.js The above code should print "[]\n[3]", but instead it prints "[3]\n[3]"! It works as expected, if you change "js = []" to "def __init__ (self): self.js = []" ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1549499&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com