interval arithmetic libraries

srepmub mark.dufour at gmail.com
Sat Jun 6 14:15:18 CEST 2009


Hi all,

I'm looking for libraries that allow one to calculate with sets of
(date) intervals. So for example, I'd like to be able to calculate the
overlap between two sets of intervals, the union etc. Preferrably,
this works with datetime objects, is written in pure Python, and has
reasonably good (algorithmic) performance. The neatest library I've
found so far is this one:

http://members.cox.net/apoco/interval/

>From an API standpoint, it looks rather nice, but the performance
could be better (for example, calculating an overlap now involves
looping quadratically over both interval sets), and it doesn't work
fully with datetime objects (Inf doesn't work).


Thanks for any pointers,
Mark Dufour.
(author of Shedskin, an experimental (restricted-)Python-to-C++
compiler, http://shedskin.googlecode.com)





More information about the Python-list mailing list