Organizing Sequential Data (TimeStamps) Overthinking?

Raymond Hettinger python at rcn.com
Fri Oct 19 21:17:41 CEST 2007


On Oct 19, 11:26 am, xkenneth <xkenn... at gmail.com> wrote:
> All,
>
>    Just a quick question. I want to be able to have a data structure
> that organizes data (timestamps I'm working with) sequentially, so
> that i can easily retrieve the first x amount of timeStamps without
> iterating over a list. My thought was to use a binary tree, am i
> overthinking the problem to try and implement this structure inside of
> python? I was also hoping this would already be done for me.

Try heapq.nsmallest().


Raymond





More information about the Python-list mailing list