[Tutor] seek and slice a range in a list of dates

Alan Gauld alan.gauld at btinternet.com
Sun Feb 10 01:02:56 CET 2008


"washakie" <washakie at gmail.com> wrote

> dates, to selected dates (Tstart, Tend)... Now, I need to get all 
> the dates
> (slice) from the dictionary in between the two dates TstartNew and 
> TendNew.
> Basically, I need to know what the 'index' is for them in the in the
> dictionay dates_dt. How can I get that information out of the lambda
> functions? does python have a 'find' function??

I think you might need to read up on hash tables - try wikipedia.

There is no index as such. A dictionary is a hash table
usually implented as a sparce array or tree structure
so you cannot traverse it sequentially - thats why order
is not guaranteed in a dictionary.

I think you need to reconsider your data structure.

Alan G 




More information about the Tutor mailing list