"Bill Allen" <walle...@gmail.com> wrote
I am convinced that I had previously assigned part_list to out_list
by
reference, not value as I mistaken thought when I first wrote the
code,
In Python variables are names which refer to objects.
So your assignment made both names refer to the same object.
Question, is it possible to copy values from one object to another
in such a
way as they are not just references one to the other?
If you want to copy a list the usual way is to create a new copy
using slicing:
newList = oldList[:]
You can also use the deepcopy module if the list is multi level.
Sorry about asking questions and then answering them. Things began
to
become more clear with each question I asked.
Thats often the way :-)
The act of articulating the problem forces you to think about it
differently.
HTH
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor