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


Groups > comp.lang.python > #69136

Re: YADTR (Yet Another DateTime Rant)

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'say,': 0.05; 'smallest': 0.07; 'ambiguity': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'roy': 0.16; 'seconds,': 0.16; 'stuff.': 0.16; 'subclass': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'wed,': 0.18; 'seems': 0.21; 'appears': 0.22; 'cc:addr:python.org': 0.22; 'days,': 0.24; 'specify': 0.24; 'cc:2**0': 0.24; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'context.': 0.31; 'decimal': 0.31; 'probably': 0.32; 'guess': 0.33; 'comment': 0.34; '"the': 0.34; 'subject: (': 0.35; "can't": 0.35; 'something': 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'half': 0.37; 'seconds': 0.37; 'wrong': 0.37; 'so,': 0.37; 'whatever': 0.38; 'that,': 0.38; 'realize': 0.39; 'duration': 0.60; 'units': 0.60; 'year.': 0.61; 'first': 0.61; 'back': 0.62; 'map': 0.64; 'more': 0.64; 'mar': 0.68; '26,': 0.68; 'square': 0.74; 'actually,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=SnrnC6lk1Rzsd563qZZ7jJ55SyOXnVEazSLqr397/E4=; b=i1L20JCgI2HQJQydFr076yzVeqUHNwuJn3CJtxJFNaaxemMyU4B/RZxj7Lwhil81sO ZKSCswHglAjk4oO2hMERd8SemL+Mu0IxuTXYRpLpgJ89p5pPcY7jCsyJFiNiITpmbV48 EyR1GUkMOkNu1mLCHaagUumRDsi5ZNvgLA77vs1jOVRkG/6mv/LzJMyGTPcaN/fjQste JMrut8AbyC5QehnrgEt7TrlcAsTZOwtkg6Ki72IgS3ak9HXue22ZLbwxiRMES/s7V1sG V/pUtGcbyMsszk6RiYLLx5ZP2/nS9ffS3JxPasKxXuxbNZO/eeZt06/O4bBOuUER0o93 /wkQ==
MIME-Version 1.0
X-Received by 10.50.79.194 with SMTP id l2mr25237053igx.8.1395851677493; Wed, 26 Mar 2014 09:34:37 -0700 (PDT)
Sender skip.montanaro@gmail.com
In-Reply-To <87a9cdx87t.fsf@elektro.pacujo.net>
References <roy-142548.20582725032014@news.panix.com> <mailman.8575.1395841035.18130.python-list@python.org> <1102ec6b-6205-40f4-bb7c-d40f9d13115b@googlegroups.com> <mailman.8581.1395848399.18130.python-list@python.org> <87a9cdx87t.fsf@elektro.pacujo.net>
Date Wed, 26 Mar 2014 11:34:37 -0500
X-Google-Sender-Auth zl4LlpYhZLfa11bBmHEH-SqvZx8
Subject Re: YADTR (Yet Another DateTime Rant)
From Skip Montanaro <skip@pobox.com>
To Marko Rauhamaa <marko@pacujo.net>
Content-Type text/plain; charset=UTF-8
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.8583.1395851680.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395851680 news.xs4all.nl 2834 [2001:888:2000:d::a6]:33527
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69136

Show key headers only | View raw


On Wed, Mar 26, 2014 at 10:58 AM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Fractions of seconds are supported -- the other fields can't be
> fractional.

Actually, it appears that whatever the last value you give can be
fractionated.  From the Wikipedia page you referenced:

"The smallest value used may also have a decimal fraction, as in
"P0.5Y" to indicate half a year."

> As you say, P1M really means one month and P1Y means one year. The
> ambiguity is intentional; if you mean to pay your employees monthly,
> the interval is one month.

True.  Your comment about monthly intervals makes me realize that you
probably can't map timedelta objects onto this ISO8601 duration
stuff. It seems like if you want to specify "pay my employees on the
first of every month", then timedelta objects are the wrong thing. You
want a recurrence relation, which is a more complex beast. For that,
you want something like dateutil.rrule. There is a good reason that
the internal units of timedelta objects are days, seconds, and
microseconds. They are well-defined outside of a calendar context.

So, I guess Roy is back to square one. He can always roll his own
timedelta subclass and give it a __str__ implementation...

S

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


Thread

YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-25 20:58 -0400
  Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-25 18:19 -0700
  Re: YADTR (Yet Another DateTime Rant) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-26 09:27 +0000
  Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 08:37 -0500
    Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 08:04 -0700
      Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 10:39 -0500
        Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 17:58 +0200
          Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 11:34 -0500
            Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 19:13 +0200
            Re: YADTR (Yet Another DateTime Rant) Grant Edwards <invalid@invalid.invalid> - 2014-03-26 19:12 +0000
              Re: YADTR (Yet Another DateTime Rant) Ben Finney <ben+python@benfinney.id.au> - 2014-03-27 07:06 +1100
      Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 11:50 -0400
  Re: YADTR (Yet Another DateTime Rant) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-03-26 15:02 +0100
    Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 16:43 +0200
  Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 01:12 +1100
    Re: YADTR (Yet Another DateTime Rant) Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-27 11:08 +1300
  Re: YADTR (Yet Another DateTime Rant) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-03-26 19:25 -0400
    Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-27 00:16 +0000
      Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 12:28 +1100
        Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 21:38 -0400
          Re: YADTR (Yet Another DateTime Rant) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-27 08:40 +0000
      Re: YADTR (Yet Another DateTime Rant) Dan Sommers <dan@tombstonezero.net> - 2014-03-27 03:56 +0000
      Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 11:22 +0100
        Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 21:44 +1100
          Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 12:05 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 22:33 +1100
          Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 12:25 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 22:42 +1100
            Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-27 06:56 -0500
              Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-27 16:04 +0200
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 23:20 +1100
            Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-27 08:01 -0500
            Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 17:10 -0400
            Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-27 17:04 -0700
            Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 21:46 -0400
              Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 21:59 -0400
                Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 22:24 -0400
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-28 14:03 +1100
          Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 08:52 -0400
            Re: YADTR (Yet Another DateTime Rant) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-03-27 15:12 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-28 01:15 +1100
            Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-27 23:41 +0000
              Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 20:29 -0400
                Re: YADTR (Yet Another DateTime Rant) Ben Finney <ben+python@benfinney.id.au> - 2014-03-28 11:43 +1100
                Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-28 11:11 +0000
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 08:30 -0400
                Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-28 15:10 +0200
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 00:19 +1100
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 09:22 -0400
                Re: YADTR (Yet Another DateTime Rant) Rustom Mody <rustompmody@gmail.com> - 2014-03-28 06:30 -0700
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 00:32 +1100
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 09:20 -0400
                Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-28 16:34 +0200
                Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-28 14:35 +0000
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 02:25 +1100
  Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-26 16:33 -0700

csiph-web