Python Module Exposure

George Sakkis gsakkis at rutgers.edu
Sun Jul 10 08:32:48 EDT 2005


"Jacob Page" <apoco at cox.net> wrote:

> If the union of two integers yielded a set of integers, then
> it'd make more since for the union of two Intervals to yield an
> IntervalSet.

AFAIK union is defined over sets, not numbers, so I'm not sure what you
mean by the "union of two integers". What I'm saying is that while the
union of two intervals is always defined (since intervals are sets),
the result set is not guaranteed to be an interval. More specifically,
the result is an interval if and only if the intervals overlap, e.g.
(2,4] | [3,7] = (2,7]
but
(2,4] | [5,7] = { (2,4], [5,7] }
That is, the set of intervals is not closed under union. OTOH, the set
of intervals _is_ closed under intersection; intersecting two
non-overlapping intervals gives the empty interval.

George




More information about the Python-list mailing list