[BangPypers] Are comprehensions faster?
orsenthil at gmail.com
Mon Feb 9 14:41:12 CET 2009
On Mon, Feb 9, 2009 at 7:06 PM, Senthil Kumaran <orsenthil at gmail.com> wrote:
>>>> timeit.Timer("for i in range(1000): l.append(i)","l=").timeit(number=1000)
> You see that is slow and the reason is l.append being called again
> and again. lets eliminate it.
Sorry, it is slow because the append method "Look-up" on the list
object is done again and again.
Read further. Rest of my explanation is okay.
More information about the BangPypers