Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106449 > unrolled thread

Re: ANN: intervalset Was: Set type for datetime intervals

Started byRandom832 <random832@fastmail.com>
First post2016-04-04 11:44 -0400
Last post2016-04-04 11:44 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: ANN: intervalset Was: Set type for datetime intervals Random832 <random832@fastmail.com> - 2016-04-04 11:44 -0400

#106449 — Re: ANN: intervalset Was: Set type for datetime intervals

FromRandom832 <random832@fastmail.com>
Date2016-04-04 11:44 -0400
SubjectRe: ANN: intervalset Was: Set type for datetime intervals
Message-ID<mailman.24.1459784665.32530.python-list@python.org>
On Mon, Apr 4, 2016, at 11:32, Oscar Benjamin wrote:
> On 4 April 2016 at 16:09, Random832 <random832@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web