*-unpacking

Michael Hudson mwh at python.net
Fri Oct 3 12:42:52 EDT 2003


Alex Martelli <aleax at aleax.it> writes:

> So -- it's clear to me that I do NOT understand what's going on
> here.  If just the ags[:] is 35.2 usec, how can the ags[:].pop(0)
> be 24.5 ... ???

How quiet was your machine when you ran the tests?  I see behaviour
more in line with what you'd expect:

[mwh at pc150 build]$ ./python ../Lib/timeit.py -s'ags=range(1000)' 'x=ags[:]'
10000 loops, best of 3: 31.6 usec per loop
[mwh at pc150 build]$ ./python ../Lib/timeit.py -s'ags=range(1000)' 'x=ags[:].pop(0)'
10000 loops, best of 3: 39.8 usec per loop

Cheers,
mwh

-- 
  About the use of language: it is impossible to sharpen a
  pencil with a blunt axe.  It is equally vain to try to do
  it with ten blunt axes instead.
      -- E.W.Dijkstra, 18th June 1975. Perl did not exist at the time.




More information about the Python-list mailing list