[Python-ideas] `OrderedDict.items().__getitem__`
Chris Angelico
rosuav at gmail.com
Sun Jan 12 00:24:47 CET 2014
On Sun, Jan 12, 2014 at 10:01 AM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
> It is pretty inefficient. As for getting the last item, however, I think
> something like that might end up the best.
>
For getting the last item, reversed() should be as fast as iter() is
for getting the first - at least in CPython 3.4, which is what I was
looking at.
> And, you've gotta admit, it isn't bad for a 30-second solution with no real
> planning whatsoever.
There is that :)
ChrisA
More information about the Python-ideas
mailing list