On Mon, Apr 4, 2016, at 11:32, Oscar Benjamin wrote: > On 4 April 2016 at 16:09, Random832 <random...@fastmail.com> wrote: > > Like I said before, I don't think the set-like operations on Intervals > > are useful - what can you accomplish with them rather than by making a > > set consisting of only one interval and doing operations on that? > > I guess it depends what your application is but sympy has interval > sets and can do computation on them to represent the solutions of > equations/inequalities (many other types of set are also included).
Yes, my question is why it's useful to have a single Interval as a *distinct* type, separate from the interval set type, which supports a sharply limited number of set-like operations (such as the union of two overlapping intervals but NOT two non-overlapping ones). This doesn't appear to be the case in sympy based on your examples. Having an interval as a distinct type may be useful (to iterate over the intervals of a set, for example), but his design blurs the line between intervals and sets (by supporting some set operations) without eliminating it as sympy seems to do. > In [6]: Interval(1, 2) | Interval(3, 4) > Out[6]: [1, 2] ∪ [3, 4] > > There is some discussion about why it's good to do this stuff with > sets (for sympy's purposes here): > http://docs.sympy.org/latest/modules/solvers/solveset.html#why-do-we-use-sets-as-an-output-type -- https://mail.python.org/mailman/listinfo/python-list