larry.bates at websafe.com`
Mon Jun 30 15:13:30 CEST 2008
Peter Otten wrote:
> Ampedesign wrote:
>> If I happen to have a list that contains over 50,000 items, will the
>> size of the list severely impact the performance of appending to the
> $ python -m timeit -n20000 -s"items = " "items.append(42)"
> 20000 loops, best of 3: 0.554 usec per loop
> $ python -m timeit -n20000 -s"items = *10**6" "items.append(42)"
> 20000 loops, best of 3: 0.529 usec per loop
So its actually faster to append to a long list than an empty one? That
certainly would not have been intuitively obvious now would it?
More information about the Python-list