New submission from andrew <atc...@gmail.com>: After debugging for a while I finally released that I stumbled across a Python bug (at least I believe it is). Here is a proof of concept that produces the issue:
!/usr/bin/python class blah: def __init__(self, items=[]): self.items = items a = blah() b = blah() a.items.append("apples") b.items.append("oranges") print a.items print b.items print id(a.items) print id(b.items) and here is the output when the program is run: r...@x:~# python pythonbug.py ['apples', 'oranges'] ['apples', 'oranges'] 135923500 135923500 r...@x:~# as you can see the 'items' reference is the same for both objects even though they are different objects. I checked the manual and I couldn't find anything explaining such behavior. Can this possibly be correct? My python info: Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48) ---------- messages: 106018 nosy: bolt priority: normal severity: normal status: open title: default value in constructor not unique across objects type: behavior versions: Python 2.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8762> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com