On Wed, 04 Oct 2006 16:02:56 GMT
"David Isaac" <[EMAIL PROTECTED]> wrote:
> Is it expected for access to set elements to be much
> slower than access to list elements? Explanation?
> Thanks,
> Alan Isaac
>
> >>> t1=timeit.Timer("for i in set(xrange(10000)):pass","")
> >>> t2=timeit.Timer("for i in list(xrange(10000)):pass","")
> [...]
You're measuring the time for creating the xrange and the set/list too.
Create them before you call Timer() and repeat your timing.
Dennis Benzinger
--
http://mail.python.org/mailman/listinfo/python-list