item access time: sets v. lists

Neil Cerutti horpner at
Wed Oct 4 21:01:09 CEST 2006

On 2006-10-04, Paul McGuire <ptmcg at> wrote:
> "Neil Cerutti" <horpner at> wrote in message 
> news:slrnei7sc2.fs.horpner at
>> Look at the code again. It's not testing what it says it's
>> testing.
> It isnt?
> The only quibble I can see is that there really is no "first"
> element in a set.  I picked the "0 in set" and "0 in list" to
> pick the fastest case for list, which does a linear search
> through the list elements.
> Where did I go wrong on the test descriptions?

It seems to be timing "testing for membership", not "random
access". Random access is just seq[n]; at least, that's the
assumption I made.

Perhaps I read the test description out of context and got

Neil Cerutti
8 new choir robes are currently needed, due to the addition of
several new members and to the deterioration of some of the
older ones. --Church Bulletin Blooper 

More information about the Python-list mailing list