On Thu, 10 Mar 2005 14:37:25 +0100, Stefan Behnel <[EMAIL PROTECTED]> > There. Factor 10. That's what I call optimization...
The simplest approach is even faster: C:\>python -m timeit -s "from itertools import repeat" "[None for i in range(10000)]" 100 loops, best of 3: 2.53 msec per loop C:\>python -m timeit -s "from itertools import repeat" "[None for i in xrange(10000)]" 100 loops, best of 3: 2.45 msec per loop C:\>python -m timeit -s "from itertools import repeat" "list(repeat(None, 10000))" 1000 loops, best of 3: 245 usec per loop C:\>python -m timeit -s "from itertools import repeat" "[None] * 10000" 10000 loops, best of 3: 160 usec per loop ;-) BTW, I've posted a more general version here: http://www.brunningonline.net/simon/blog/archives/001784.html -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list