[New-bugs-announce] [issue3755] Lists propagate through new instances of class if using append

supernova_hq report at bugs.python.org
Tue Sep 2 02:55:01 CEST 2008


New submission from supernova_hq <supernova_hq at hotmail.com>:

I have located a bug where every instance of an identical class (or a
class that extends it) will use the same copy of any list element
created before __init__.

The only way I have found to fix this is to explicitly empty the list
inside the __init__ function before the list is used.

Please view and run the attached code for the example.

----------
components: None
files: bug_reproduction_test.py
messages: 72305
nosy: supernova_hq
severity: normal
status: open
title: Lists propagate through new instances of class if using append
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file11338/bug_reproduction_test.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3755>
_______________________________________


More information about the New-bugs-announce mailing list