Mark Dickinson <dicki...@gmail.com> added the comment:

This is a bug in your code, rather than in Python.

A simpler example, for the purposes of explanation:

>>> root, total = [0], []
>>> total.append(root)
>>> total  # good so far
[[0]]
>>> root[0] = 1   # modify root
>>> total  # note that total changes here!
[[1]]
>>> total.append(root)
>>> total
[[1], [1]]

In effect, total contains two references to the same list.  Modify that list, 
and you'll see those changes reflected in `total` as well.

----------
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8023>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to