Re: Is this a refrence issue?

2005-12-29 Thread Scott David Daniels
KraftDiner wrote: > I have a list and want to make a copy of it and add an element > to the end of the new list, but keep the original intact Nobody has mentioned the obvious yet: tmp = myList + [something] --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listi

Re: Is this a refrence issue?

2005-12-28 Thread Steven D'Aprano
On Wed, 28 Dec 2005 14:40:45 -0800, Carl J. Van Arsdall wrote: > KraftDiner wrote: >> I understand that everything in python is a refrence > >> I have a small problem.. >> >> I have a list and want to make a copy of it and add an element to the >> end of the new list, >> but keep the original

Re: Is this a refrence issue?

2005-12-28 Thread James Tanis
On 12/28/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > KraftDiner wrote: > > I understand that everything in python is a refrence > > > > I have a small problem.. > > > > I have a list and want to make a copy of it and add an element to the > > end of the new list, > > but keep the origi

Re: Is this a refrence issue?

2005-12-28 Thread Mike Meyer
"KraftDiner" <[EMAIL PROTECTED]> writes: > I understand that everything in python is a refrence Correct. > I have a small problem.. Maybenot so small. > I have a list and want to make a copy of it and add an element to the > end of the new list, > but keep the original intact > > so: >

Re: Is this a refrence issue?

2005-12-28 Thread Jean-Paul Calderone
On Wed, 28 Dec 2005 14:40:45 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >KraftDiner wrote: >> I understand that everything in python is a refrence >> >> I have a small problem.. >> >> I have a list and want to make a copy of it and add an element to the >> end of the new list, >>

Re: Is this a refrence issue?

2005-12-28 Thread Carl J. Van Arsdall
KraftDiner wrote: > I understand that everything in python is a refrence > > I have a small problem.. > > I have a list and want to make a copy of it and add an element to the > end of the new list, > but keep the original intact > > so: > tmp = myList > tmp = myList is a shallow copy

Is this a refrence issue?

2005-12-28 Thread KraftDiner
I understand that everything in python is a refrence I have a small problem.. I have a list and want to make a copy of it and add an element to the end of the new list, but keep the original intact so: tmp = myList tmp.append(something) print tmp, myList should be different... -- htt