On Oct 7, 7:14 pm, Duncan Smith <[EMAIL PROTECTED]> wrote: > No. The above constructs a list of keys and searches the list for the > key, O(n). "key in somedict" is a lookup, O(1).
My point wasn't in regard to implementation details, but in regard to convenience methods. Obviously the sugary dict methods are tweaked for the best performance (one would hope!), as would be sugary sequence methods were they to be added. What I was wondering is why dict.has_key() and get() are there but not list.has_index() and get(). Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list