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


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

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

Started byOscar Benjamin <oscar.j.benjamin@gmail.com>
First post2016-04-04 16:32 +0100
Last post2016-04-04 16:32 +0100
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 Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-04-04 16:32 +0100

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

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2016-04-04 16:32 +0100
SubjectRe: ANN: intervalset Was: Set type for datetime intervals
Message-ID<mailman.23.1459783974.32530.python-list@python.org>
On 4 April 2016 at 16:09, Random832 <random832@fastmail.com> wrote:
> On Mon, Apr 4, 2016, at 03:12, Nagy László Zsolt wrote:
>>
>>   Hi All,
>>
>> If anyone is interested, a module was born:
>>
>> https://bitbucket.org/nagylzs/intervalset
>> https://pypi.python.org/pypi/intervalset/0.1.1
>
> I don't know if I like it being immutable. Maybe have separate mutable
> and immutable versions.
>
> 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).
For example:

In [1]: from sympy import Interval

In [2]: Interval
Out[2]: sympy.core.sets.Interval

In [3]: Interval(1, 2)
Out[3]: [1, 2]

In [4]: help(Interval)


In [5]: Interval(1, 2) & Interval(3, 4)
Out[5]: ∅

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

--
Oscar

[toc] | [standalone]


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


csiph-web