[issue7800] Attributes of type list are static
New submission from Chris Carter : The test case at the end of this message seems to indicate that the list is being initialized only once for all wrapper instances. I've tried to find anything about static members in Python and came up empty. I also found no relevant existing bugs. Expected output: 0 [0] 1 [1] 2 [2] 3 [3] Actual output: 0 [0] 1 [0, 1] 2 [0, 1, 2] 3 [0, 1, 2, 3] Test case: i = 0 class Lister: list = [] string = "" def __init__(self): global i self.list.append(i) self.string += str(i) i += 1 def __str__(self): return "%s %s" % (self.string, self.list) print Lister() print Lister() print Lister() print Lister() -- components: Interpreter Core messages: 98483 nosy: Chris.Carter severity: normal status: open title: Attributes of type list are static versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue7800> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7643] What is a Unicode line break character?
Chris Carter added the comment: Then I must ask, why did the string attribute behave differently? I added it to allow for that, and the behavior seems inconsistent. -- nosy: +Chris.Carter ___ Python tracker <http://bugs.python.org/issue7643> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7643] What is a Unicode line break character?
Chris Carter added the comment: My bad, wrong bug. -- ___ Python tracker <http://bugs.python.org/issue7643> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7800] Attributes of type list are static
Chris Carter added the comment: Then I must ask, why did the string attribute behave differently? I added it to allow for that, and the behavior seems inconsistent. -- ___ Python tracker <http://bugs.python.org/issue7800> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7800] Attributes of type list are static
Chris Carter added the comment: Ha, fun with language features. Thanks for the detailed explanation. :) -- ___ Python tracker <http://bugs.python.org/issue7800> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7643] What is a Unicode line break character?
Chris Carter added the comment: unwatched -- ___ Python tracker <http://bugs.python.org/issue7643> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com