"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On 2006-10-04, Paul McGuire <[EMAIL PROTECTED]> wrote:
>> "Neil Cerutti" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>
>
> 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
> confused.
>

Oh, poor wording on my part, sorry.

You got me wondering what seq[n] would give me in the case of a set:

>>> z = set(range(100))
>>> z[30]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unindexable object
>>>

It really doesn't make any sense since sets are unordered.  So we couldn't 
compare lists and sets in this manner anyway.

I *did* learn that dicts and sets use a hash table, not a tree, which also 
helps explain why the initial construction of the 10000-element set takes so 
much longer than just simple assembly of the range into a list.

-- Paul


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to