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


Groups > comp.lang.python > #106448

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

Path csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Newsgroups comp.lang.python
Subject Re: ANN: intervalset Was: Set type for datetime intervals
Date Mon, 4 Apr 2016 16:32:32 +0100
Lines 46
Message-ID <mailman.23.1459783974.32530.python-list@python.org> (permalink)
References <56FE0625.5030901@shopzeus.com> <1459523394.2611014.565840994.593DD99A@webmail.messagingengine.com> <570213CB.8040101@shopzeus.com> <1459782597.3444051.568344234.048046C6@webmail.messagingengine.com> <CAHVvXxRRmJKHq-H8xotY9yF+pzG+7NOSMhOwTbL4qF-N4XjTfQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de cBh4oOnGPMRv1UfoN8bsMAVnVv4M3gP9DEVwsqwVq+4Q==
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'that?': 0.05; 'url:bitbucket': 0.05; 'subject:ANN': 0.07; 'versions.': 0.07; 'cc:addr:python-list': 0.09; '[1,': 0.09; '[1]:': 0.09; '[2]:': 0.09; '[3]:': 0.09; 'immutable': 0.09; 'mutable': 0.09; 'example:': 0.10; '2016': 0.16; '[4]:': 0.16; 'cc:name:python list': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set- like': 0.16; 'subject:Was': 0.16; 'subject:type': 0.16; "sympy's": 0.16; 'wrote:': 0.16; 'all,': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'purposes': 0.20; 'sets': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'discussion': 0.24; 'mon,': 0.24; 'module': 0.25; 'separate': 0.27; 'message- id:@mail.gmail.com': 0.27; 'consisting': 0.29; 'guess': 0.31; 'operations': 0.31; 'anyone': 0.32; 'maybe': 0.33; 'useful': 0.33; 'url:python': 0.33; '(for': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'depends': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'doing': 0.38; 'received:209': 0.38; 'stuff': 0.38; 'represent': 0.38; 'why': 0.39; 'application': 0.39; 'rather': 0.39; 'skip:e 20': 0.39; 'some': 0.40; 'your': 0.60; 'making': 0.62; 'url:0': 0.63; 'interested,': 0.69; 'nagy': 0.84; 'oscar': 0.84; 'subject:Set': 0.91; 'url:latest': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=cppc2EAl9u4oJ/cExWFeIQcZqAldtKD14l3zg9/gxHU=; b=Pw3R3aWhBNpCPmI5wkso23XFTPmQHRc8AsHmUPz8xoGS1lveq4Bh+RfHYj9e/u6m7+ O50JutibibTzdGiuOstNbcnnTdUgtZrYpF0E6W1Uin8vlf6t2lzk0UgR6iqZRwNCd8pM vkUjDi7w+6L12fzWcssCdLnTNbgos9dXlaMLfwkigRY0PwvlRd9+L5OBUD273uSSTykW zdS577As//m3ZbR+C7feraquF/0c5uUOqD2FqbAAKrXwxLcL0KnAnlpEDn2ZzNG4UBKj ZVAhQLrhApnkhJQBMZN0wXiG5/Hj6kIUb5ipYnt5JTdoEerZe1hdnYfZHAcNeRmmMRXv jikQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=cppc2EAl9u4oJ/cExWFeIQcZqAldtKD14l3zg9/gxHU=; b=BTMZ6v9lBdi0YjB8Ri749iO9Rh8mntnaiYwQIdQ8AXVeg8vCtc2KAMn1IkCgjMoRPy SX9q5CAkPcj3gLLHaBfSbTyId/3fpW8jtOWb+CZXe1c11/at1oFWyecyr1RW2rta3qsF J6xnx71HlV/OVsjotpWE95g0T+pVMR6QTD7OC1f+zTXSPWEhjan0hiau87BS7uYPaz0M mOqQ1UqakUKE/ASSCh7UvoYMTu6V/52msUj8aBpUDzyyKrj0TMgponU8z86sNg/rZYMd 230sIn4cZtZEgyBana2rRBQY0w2eajbm9o56vNvlfW4h5lXxNodFAwx4AfyFbkVki8v/ rX3g==
X-Gm-Message-State AD7BkJLVGip8NAsV1eTJVCFTK2dndkehDHjkxN30xeJb2kQUSe0RLNqDS2LWIHrZ2vX2KloBEJ+h8U1OcK1BQw==
X-Received by 10.112.198.132 with SMTP id jc4mr8821639lbc.120.1459783971730; Mon, 04 Apr 2016 08:32:51 -0700 (PDT)
In-Reply-To <1459782597.3444051.568344234.048046C6@webmail.messagingengine.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAHVvXxRRmJKHq-H8xotY9yF+pzG+7NOSMhOwTbL4qF-N4XjTfQ@mail.gmail.com>
X-Mailman-Original-References <56FE0625.5030901@shopzeus.com> <1459523394.2611014.565840994.593DD99A@webmail.messagingengine.com> <570213CB.8040101@shopzeus.com> <1459782597.3444051.568344234.048046C6@webmail.messagingengine.com>
Xref csiph.com comp.lang.python:106448

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: ANN: intervalset Was: Set type for datetime intervals Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-04-04 16:32 +0100

csiph-web