[Tutor] Can someone please help me with this?

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Nov 7 10:23:31 CET 2013


On 7 November 2013 02:56, Alex Kleider <akleider at sonic.net> wrote:
> On 2013-11-06 01:52, Oscar Benjamin wrote:
>
>>
>> I'll give one suggestion which is that to concatenate one list onto
>> the end of another you would use the .extend() method rather than the
>> .append() method.
>
>
> What would be the advantage/disadvantage of what you suggest vs using the
> plus (+) operand as in
> l = l1 + l2
> ??

As Dave says l1 + l2 creates a new list. However l1 += l2 does the
same as the extend method and mutates l1 in place.


Oscar


More information about the Tutor mailing list