In article <mailman.1241.1244301490.8015.python-l...@python.org>, akindo <akind...@hotmail.com> wrote: > >So, it seems I want the best of both worlds: specific indexing using >my own IDs/keys (not just by list element location), sorting and the >ability to start iterating from a specific location. I am trying to >prevent having to scan through a list from the beginning to find the >desired ID, and then return all elements after that. Is there another >data structure or design pattern which will do what I want? Thanks a >lot for any help! :)
One option is to maintain both a dict and a list; it doesn't cost much memory because the individual elements don't get copied. See various "ordered dictionary" implementations for ideas on coding this. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you don't know what your program is supposed to do, you'd better not start writing it." --Dijkstra -- http://mail.python.org/mailman/listinfo/python-list