Set type for datetime intervals

Random832 random832 at fastmail.com
Fri Apr 1 11:09:54 EDT 2016


On Fri, Apr 1, 2016, at 01:24, Nagy László Zsolt wrote:
>  
>   Hello,
> 
> I need to compare sets of datetime intervals, and make set operations on
> them: intersect, union, difference etc. One element of a set would be an
> interval like this:

Two thoughts on this: Such an object is not precisely a set* of
datetimes, rather it is a set of nonintersecting intervals. It could
also be useful to have one for numbers (the datetime version could even
maybe be implemented in terms of it)

*in the python sense. in the mathematical sense, it is a set with
infinite* cardinality
**well, datetimes have a fixed resolution, so it's not _really_
infinite. Numbers don't, though.

> element ::= (start_point_in_time, end_point_in_time)
> intervalset ::= { element1, element2, .... }

Are these open intervals or closed intervals?

Also, how are you going to handle daylight savings?



More information about the Python-list mailing list