On Tue, May 6, 2014 at 1:21 PM, Dave Angel wrote:
> You're right to be confused; my fingers were confused typing my
> last sentence. It should have ended:
>... you should use + .
>
> Likewise the previous thought should have said:
>
> But in any similar
> example, if list2 is t
Denis Heidtmann Wrote in message:
> On Sun, May 4, 2014 at 6:44 PM, Dave Angel wrote:
>> C Smith Wrote in message:
>>> Sorry.
>>>
>>> I meant for example:
>>> list1 = [1,2,3]
>>> list2 = [3,4,5]
>>>
>>> newList = list1 + list2
>>>
>>> versus
>>>
>>> for x in list2:
>>> list1.append(x)
>>>
>>
On Sun, May 4, 2014 at 6:44 PM, Dave Angel wrote:
> C Smith Wrote in message:
>> Sorry.
>>
>> I meant for example:
>> list1 = [1,2,3]
>> list2 = [3,4,5]
>>
>> newList = list1 + list2
>>
>> versus
>>
>> for x in list2:
>> list1.append(x)
>>
>> Which is the preferred way to add elements from on
C Smith Wrote in message:
> Sorry.
>
> I meant for example:
> list1 = [1,2,3]
> list2 = [3,4,5]
>
> newList = list1 + list2
>
> versus
>
> for x in list2:
> list1.append(x)
>
> Which is the preferred way to add elements from one list to another?
Thank you for switching to text mail.
The
C Smith wrote:
> I meant for example:
> list1 = [1,2,3]
> list2 = [3,4,5]
>
> newList = list1 + list2
>
> versus
>
> for x in list2:
>list1.append(x)
>
> Which is the preferred way to add elements from one list to another?
None of the above unless you need to keep the original list1. Use
On Sun, May 04, 2014 at 09:51:17AM -0400, C Smith wrote:
> Sorry.
>
> I meant for example:
> list1 = [1,2,3]
> list2 = [3,4,5]
>
> newList = list1 + list2
This creates a new list, containing the same items as list1 and list2.
> versus
>
> for x in list2:
> list1.append(x)
This can be writ
Sorry.
I meant for example:
list1 = [1,2,3]
list2 = [3,4,5]
newList = list1 + list2
versus
for x in list2:
list1.append(x)
Which is the preferred way to add elements from one list to another?
On Sun, May 4, 2014 at 7:36 AM, Dave Angel wrote:
> C Smith Wrote in message:
>>
>>
> I had alw
C Smith Wrote in message:
>
>
I had always assumed that append() was more efficient, but some recent
discussions seem to point at that it is the same as append(). Which is
preferable and why?
Please be more explicit, preferably with example code.
list.append and list.__add__ don't even do th
I had always assumed that append() was more efficient, but some recent
discussions seem to point at that it is the same as append(). Which is
preferable and why?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https: