Working with dates : complex problem

Thibaut DIRLIK merwin.irc at gmail.com
Thu May 24 03:31:40 EDT 2012


Hi,

I've a list of python objects with dates attributes. This list is ordered
by one of these date. Elements mandatory follow each other :

Element #1                   Element #2           Element #3
|-------------------------|--------------|--------------------------|

Now, I want to "insert" an element in this timeline. This imply that I will
have to resize some elements :

Element #1                   Element #2           Element #3
|-------------------------|--------------|--------------------------|
                New element
          |----------------------|

And after resize :

Element #1      New element       Element #2       Element #3
|---------|----------------------|---------|--------------------------|

          |----------------------|

My question is the following : how can I know (easily) which elements my
"New element" is "over", which,
in my example would have returned ['Element #1', 'Element #2'].

Elements objets are simple Python objects with dates :

obj.begin = datetime()
obj.end = datetime()

I'm looking for the more Pythonic way to handle this problem, thanks !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120524/54e4f576/attachment.html>


More information about the Python-list mailing list