in place-ness of list.append

Alexander Schmolck a.schmolck at gmail.com
Mon Feb 5 10:57:20 EST 2007


Alexander Schmolck <a.schmolck at gmail.com> writes:

> skip at pobox.com writes:
> 
> > >>>>> "Bart" == Bart Van Loon <bbbart at inGen.be> writes:
> > 
> >     >> Such an operation will be O(N**2), 
> > 
> >     Bart> why is that?
> > 
> > The a[:] operation makes a copy of a (as will the x = a + [n] idiom).
> 
> I'm pretty confident append itself (and a+[n]) are linear in N=len(a) since

Sorry -- I just see that I missed your other post.

'as



More information about the Python-list mailing list