On Sat, Aug 23, 2008 at 6:47 AM, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > At first I thought the bisect module was the way to go, but it is too > tightly tied to integer list indices, and works very awkwardly when > bisecting on datetime attributes.
I'm not sure what the problem is with bisect (to find the starting point). Your list of model elements has integer indices. I think you have to write a __cmp__ method for your model class that compares on the datetime attribute, then it should work. You can also create a list of (key, model) and sort/search that. http://www.mail-archive.com/[EMAIL PROTECTED]/msg189443.html > List slices produce copies, unless I'm > mistaken. List slices copy the references in the list, not the values. I.e. it is not a deep copy. So you will have only one copy of each model instance even if you slice up the list. So, unless your lists are very large or you have many levels in your hierarchy, this might work. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor