Message106018
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:
root@x:~# python pythonbug.py
['apples', 'oranges']
['apples', 'oranges']
135923500
135923500
root@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) |
|
Date |
User |
Action |
Args |
2010-05-19 00:35:35 | bolt | set | recipients:
+ bolt |
2010-05-19 00:35:35 | bolt | set | messageid: <1274229335.16.0.189072837052.issue8762@psf.upfronthosting.co.za> |
2010-05-19 00:35:32 | bolt | link | issue8762 messages |
2010-05-19 00:35:31 | bolt | create | |
|