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


Groups > comp.lang.python > #106256

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:32:43 +0000
Lines 28
Message-ID <mailman.329.1459542781.28225.python-list@python.org> (permalink)
References <56FE0625.5030901@shopzeus.com> <CAGgTfkMeWgGd+ps=pyRE90QZmwc0HuRqQs0C+my-+Dk=Xrgz1A@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 +FXzpAa3NEDzaif4pKF67wHIlWWiOVByMdze0N+nNCjQ==
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; 'email addr:gmail.com&gt;': 0.18; 'library': 0.20; 'to:name:python- list@python.org': 0.20; 'to:2**1': 0.21; 'mixed': 0.22; '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; 'michael': 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; 'received:209.85.220': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'tasks.': 0.66; '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=KTzPZvmH1GOeFz/WKvz8JGWhuqePbzKhPs5SQ+FwOG0=; b=aMOMUmpXfSFTYY+SETi8ZWd1sfUkuMLKMJoSg4ASFH4/PukcP5SKHB/p3nWVBhqxve KG8zPxvazljakXGuVHBeik65kaSY5fDozkiTZn8/oEefqDdp8UpuN5bWhFp9JPJSZW+V kBbffmokGqCDoL2IYne9y14/86/vvXiLj4LBz1Ik8cDySmDCzB7frUcK634f0X+V4r4S fNIep0QFSFf3y4ZIje0ry8ONxqOwv1v7skkwR5xrXbxVsyilzu8JYjAVOyUZujmrcTT7 zUzhbAt/n3eNzi4UMsbz/GwH9ZkGUoPE2S1s1CEGPhD9p8+GQ/0iQPRAx3xHlSYSq2by w67Q==
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=KTzPZvmH1GOeFz/WKvz8JGWhuqePbzKhPs5SQ+FwOG0=; b=V7LKo3GWfhxgOCV84VyhjwRbVJ40hLUb9Ep+4NpuM0oEH9S4fZnq1iDV9tinF68jaL UTycjX5DtSkPi0pI+IKPoh5IVsQsmWi42yPjdS5cEXpppwDZlWR81sVLJhg/riQTLt7p Ig5OQokZMRcf1D6JiutbIPLmwH5QovG4jY0jx0m0AeOjxVNDvZI3YQX6liXqTjoQH4zX xzLJegL0ZcQpKsHu1WYW8JeSaaJ5XQIGMy/yn1mgA9MY5mtjutKEqrPepggOw09ZtdR5 HvKb/3PFNxxeuKf9OpFOX7SP9xYZxHZVIyfihgomRJ5lLCkRSi56Zx4E64P1DRFr0jdZ aPvw==
X-Gm-Message-State AD7BkJKo7QvwefUimXbOzC98tFWjChr+fiiZVYbrSSiQiQTIaBy4HBRTSU6O8ur+He+JnVD7l08mylHyS+dF0A==
X-Received by 10.55.79.17 with SMTP id d17mr20797912qkb.56.1459542772323; Fri, 01 Apr 2016 13:32:52 -0700 (PDT)
In-Reply-To <CAGgTfkMeWgGd+ps=pyRE90QZmwc0HuRqQs0C+my-+Dk=Xrgz1A@mail.gmail.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:106256

Show key headers only | View raw


Whoops, I mixed up tasks. Here's what I meant:

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

On Fri, Apr 1, 2016 at 4:31 PM Michael Selik <michael.selik@gmail.com>
wrote:

> 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:32 +0000

csiph-web