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


Groups > comp.lang.python > #106255

Re: Set type for datetime intervals

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Michael Selik <michael.selik@gmail.com>
Newsgroups comp.lang.python
Subject Re: Set type for datetime intervals
Date Fri, 01 Apr 2016 20:31:32 +0000
Lines 18
Message-ID <mailman.328.1459542711.28225.python-list@python.org> (permalink)
References <56FE0625.5030901@shopzeus.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 1myApzmGP9U+IR3QQPo5GQqRXGzU431sg1DVy9827wUg==
Return-Path <michael.selik@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'url:pypi': 0.03; 'builtin': 0.07; 'implements': 0.07; 'def': 0.13; '2016': 0.16; 'pypi?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:type': 0.16; 'url:submit': 0.16; 'wrote:': 0.16; 'library': 0.20; 'to:name:python-list@python.org': 0.20; 'to:2**1': 0.21; 'sets': 0.23; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'resolution': 0.28; 'anyone': 0.32; 'url:python': 0.33; 'received:google.com': 0.35; 'ones': 0.35; 'url:%3a': 0.35; 'url:org': 0.36; 'received:209.85': 0.36; 'url:action': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'url:search': 0.83; 'nagy': 0.84; 'stop,': 0.84; 'subject:Set': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=UQ/2TQ9KbFK03OCXgGMo66ZkYPt0yyAClhNUi5hUxYs=; b=dbxMwgX08/NUgynrvV44wMLywCxTlKOYb1RZ0VplKg6blckn0OsB/CP7ngJfY5cMLy VTXokkFt0seVC8Z06JwrRE02OcDNgWtn0Ly0u0OpFS5eSC63h/ZxC6SWhjAlAtfjDsDo I+UL/DjemQWANRZ2eYazYqkS9NqkA5u4nEpWWfWKX4nKO/ZRie7It/qbj9sqoW6EkzNo uePyjblV8Ekd/4qayr4Ma0qL8SuL7mOTAv9s05ZdB3LtjfI6NXjxA74SdHb9sZMdgfnf AA/TGGCCithDnojTaFq+EOB0spbminIw0ulc5im56u6jDbHKQWyl+DvC38ToIct6ULIr k9XA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=UQ/2TQ9KbFK03OCXgGMo66ZkYPt0yyAClhNUi5hUxYs=; b=SmMfho3dsPuMSUsjkYPIQZ/rMKOFTs3cszMXThspK0lk/P8Fz1LjbrTbKhMnVi0gUq IuClfhWnHbfJTfP7O86RB334yM7Enipd0rYUrW5jYmX4YiLNz1MT75NnnRj/j1KgrNje 6gdvB9FZ0f/TZNlGWj+b4O6dshV8Bvg8j5YPjlUBnQCfn17M0vlODRVdlljq9UF9Qs90 ZIph3oWFV4gZE7ebBPaRLYIkHojyWGMbxyEbJQl3qt4MuLrQBoU9kVNqiyabrqV0mo7P i2a0xm5I452O+jQ2pycVyM0sSlvyrU2raN0CVw+cS5s0tPHajIajr5FtMTHgBA+NionD g+jw==
X-Gm-Message-State AD7BkJLqgItzcE1icA8eEu1udqQK3ZaXzWBjjzfheBcr6f2gl88lsTuaBxNMwL7TiqqsACFLjTzVWsstuU+0ZQ==
X-Received by 10.140.22.212 with SMTP id 78mr27655652qgn.77.1459542702641; Fri, 01 Apr 2016 13:31:42 -0700 (PDT)
In-Reply-To <56FE0625.5030901@shopzeus.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.21
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>
Xref csiph.com comp.lang.python:106255

Show key headers only | View raw


On Fri, Apr 1, 2016 at 1:32 AM Nagy László Zsolt <gandalf@shopzeus.com>
wrote:

> Does anyone know a library that already implements these functions?
>

What do you not like about the ones on PyPI?
https://pypi.python.org/pypi?%3Aaction=search&term=interval&submit=search

Depending on the resolution you want, you might be able to use builtin sets
for everything.

    def interval(start, stop, precision=60):
        a = round(start.timestamp(), precision)
        b = round(stop.timestamp(), precision)
        return set(range(a, b, precision))

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


Thread

Re: Set type for datetime intervals Michael Selik <michael.selik@gmail.com> - 2016-04-01 20:31 +0000

csiph-web