MonkeeSage wrote:
>> On Oct 7, 7:14 pm, Duncan Smith <buzz... at urubu.freeserve.co.uk> 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
>
All I can say is that, I personally, would have little use for those
list methods. Those involved in the design of the language will no
doubt have much better reasons than this.
Duncan