mistersheik at gmail.com
Tue Jul 7 08:59:10 CEST 2015
What's wrong with "next(iter(o))" and "next(reversed(o))"?
On Tue, Jul 7, 2015 at 2:56 AM, Kale Kundert <kale at thekunderts.net> wrote:
> I didn't even mean for this thread to be about arbitrarily indexing into an
> OrderedDict. I meant for it to be about accessing the first and last
> items in
> an OrderedDict. Given that a method already exists to access and remove
> items, I find it hard to understand why there isn't a method to simply
> them. This should be a constant-time operation if OrderedDict employs a
> doubly-linked list under the hood.
> On 07/06/2015 09:23 PM, Neil Girdhar wrote:
> > This thread is not about hash tables. This thread is about indexing
> into an
> > ordered dictionary when you need an ordered dictionary. Someone pointed
> > that people expect indexing to be constant time. I agree that no one
> > indexing to be linear time. My point was that logarithmic-time indexing
> > reasonable and possible.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas