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
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
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
"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:
>
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,
>>
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
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