On Sun, 26 Dec 2004 04:57:17 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Ishwor" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi all > > I have just wrote a small script to compare the speed of list addition > > methods. > > There are two meanings of 'list addition': > > li = li+[item] *copies* the list and adds item > > li += [item] is the same as li.extend([item]) which add item to the end of > the list *without* copying. > > Of course, extending a list is faster than copying + one more. >
I agree with you that list extending is faster way to add as compared to method 1. also that method 2 is mapped to 'extend()' anyway, but why is the method 3 ( l3.extend() ) in my example code talking only nearly 1% of time to complete as compared to method 1/2??? I think there is a problem with the code but i don't see where. :-( > Terry J. Reedy Thanks Terry for yet another small (really small) step towards enlightment. [snip] -- cheers, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list