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


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

Re: Set type for datetime intervals

Started byMichael Selik <michael.selik@gmail.com>
First post2016-04-01 20:32 +0000
Last post2016-04-01 20:32 +0000
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: Set type for datetime intervals Michael Selik <michael.selik@gmail.com> - 2016-04-01 20:32 +0000

#106256 — Re: Set type for datetime intervals

FromMichael Selik <michael.selik@gmail.com>
Date2016-04-01 20:32 +0000
SubjectRe: Set type for datetime intervals
Message-ID<mailman.329.1459542781.28225.python-list@python.org>
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))
>

[toc] | [standalone]


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


csiph-web