<div dir="ltr">What's wrong with "next(iter(o))" and "next(reversed(o))"?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 7, 2015 at 2:56 AM, Kale Kundert <span dir="ltr"><<a href="mailto:kale@thekunderts.net" target="_blank">kale@thekunderts.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I didn't even mean for this thread to be about arbitrarily indexing into an<br>
OrderedDict.  I meant for it to be about accessing the first and last items in<br>
an OrderedDict.  Given that a method already exists to access and remove these<br>
items, I find it hard to understand why there isn't a method to simply access<br>
them.  This should be a constant-time operation if OrderedDict employs a<br>
doubly-linked list under the hood.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Kale<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 07/06/2015 09:23 PM, Neil Girdhar wrote:<br>
> This thread is not about hash tables.  This thread is about indexing into an<br>
> ordered dictionary when you need an ordered dictionary.  Someone pointed out<br>
> that people expect indexing to be constant time.  I agree that no one expects<br>
> indexing to be linear time.  My point was that logarithmic-time indexing is<br>
> reasonable and possible.<br>
</div></div></blockquote></div><br></div>