[Python-Dev] dateutil

Skip Montanaro skip at pobox.com
Thu Mar 11 16:16:17 EST 2004


    Gustavo> Have you looked at the RRULE item on the iCalendar RFC? It
    Gustavo> should tell you everything about date recurrences. If you're
    Gustavo> interested, you might want to read it, and try out the rrule
    Gustavo> implementation.

That's not what I was asking.

I realize that generating the recurrences themselves is important, but it's
not the only important thing.  Getting from the English (or Portuguese ;-)
that a user would use as input is just as important to me as having the
recurrence classes available to generate a stream of dates.  For example,
this does work using recur:

    >>> import recur
    >>> import datetime
    >>> for eachDate in recur.Recurrence(datetime.date(2004, 1, 7), "Saturday",  datetime.date(2004, 4, 15)):
    ...   print eachDate
    ... 
    2004-01-10
    2004-01-17
    2004-01-24
    2004-01-31
    2004-02-07
    2004-02-14
    2004-02-21
    2004-02-28
    2004-03-06
    2004-03-13
    2004-03-20
    2004-03-27
    2004-04-03
    2004-04-10

The point is, the Recurrence class in the recur module seems to have some
hooks builtin for this sort of stuff, but it's not been fleshed out very
well.  A PEP with some sample implementations might go a long way to making
a more complete implementation available.  The documentation seems to be
missing that would help me add it.  I think there is technology there which
doesn't exist in dateutil.  Correct me if I'm wrong.

Perhaps recur.Recurrence just needs a little more work so it can handle some
common timekeeping phraseology:

    * every Tuesday

    * every hour on the half hour

    * once an hour on the quarter hour

    * every 4 days

    * the first Monday of each month

    * every four years starting in 2000

I'll restate my suggestion that maybe a PEP for this stuff would be a good
idea.  I think it would be a reasonable idea to check both recur and
dateutil into the nondist/sandbox so other people can take a whack at them.

Skip



More information about the Python-Dev mailing list