RE: time, calendar, datetime, etc

Discussion in 'Python' started by Tim Peters, Aug 4, 2003.

  1. Tim Peters

    Tim Peters Guest

    [Dan Bishop]
    >>> There were no leap years between 10 BC and AD 4, because after
    >>> Julius Caesar's death, the priests in charge of the calendar
    >>> mistakenly added leap days every 3 years instead of 4, and this had
    >>> to be corrected.
    >>>
    >>> I wouldn't expect the datetime module to deal with that, though ;-)


    [Tim]
    >> Thank you -- some people did <wink>.


    [John Roth]
    > I don't think I noticed that:


    Were you a participant in datetime's design process (the fishbowl on
    zope.org, previously referenced)? If so, sorry, I don't recall it.

    > the entire point behind the proleptic calender is that you're
    > projecting the current practice back to times where they weren't
    > doing it that way.


    And forward too, of course. But not everyone *wanted* a proleptic calendar
    (of any flavor). The use cases on the datetime wiki turned out not to care
    either way (business uses generally don't give a rip about years before
    1900), so I pushed for the conceptual simplicity of the proleptic Gregorian
    (which coincides with current reckoning in much of the world, so satisfied
    the use cases).

    > That's clearly an opportunity for someone to add an extension -
    > except that there are other problems in that era, and the lack
    > of leap years is the least of them.


    People who care can scratch their own itches.
    Tim Peters, Aug 4, 2003
    #1
    1. Advertising

  2. Tim Peters

    John Roth Guest

    "Tim Peters" <> wrote in message
    news:...
    > [Dan Bishop]
    > >>> There were no leap years between 10 BC and AD 4, because after
    > >>> Julius Caesar's death, the priests in charge of the calendar
    > >>> mistakenly added leap days every 3 years instead of 4, and this had
    > >>> to be corrected.
    > >>>
    > >>> I wouldn't expect the datetime module to deal with that, though ;-)

    >
    > [Tim]
    > >> Thank you -- some people did <wink>.

    >
    > [John Roth]
    > > I don't think I noticed that:

    >
    > Were you a participant in datetime's design process (the fishbowl on
    > zope.org, previously referenced)? If so, sorry, I don't recall it.


    No. I didn't even know about it until recently.

    > > the entire point behind the proleptic calender is that you're
    > > projecting the current practice back to times where they weren't
    > > doing it that way.

    >
    > And forward too, of course. But not everyone *wanted* a proleptic

    calendar
    > (of any flavor). The use cases on the datetime wiki turned out not to

    care
    > either way (business uses generally don't give a rip about years before
    > 1900), so I pushed for the conceptual simplicity of the proleptic

    Gregorian
    > (which coincides with current reckoning in much of the world, so satisfied
    > the use cases).


    And I agree with that reasoning. There's no way that the module
    core can deal with historical and other cultural dates in any consistent
    or comprehensive fashion, so it shouldn't waste effort and try. On the
    same token, though, it shouldn't get in the way of people who want to
    extend it to handle additional calendar types, or bring dates back before
    1AD.

    > > That's clearly an opportunity for someone to add an extension -
    > > except that there are other problems in that era, and the lack
    > > of leap years is the least of them.

    >
    > People who care can scratch their own itches.


    Exactly.

    John Roth
    >
    >
    John Roth, Aug 4, 2003
    #2
    1. Advertising

  3. Tim Peters

    Andrew Dalke Guest

    John Roth
    > On the
    > same token, though, it shouldn't get in the way of people who want to
    > extend it to handle additional calendar types, or bring dates back before
    > 1AD.


    But it doesn't. I showed an easy way to derive from the datetime
    class to support dates before 1AD, by doing an offset of 6,000 years.

    class RothDate(object):
    def __init__(self, year, month, day):
    self._date = datetime.date(year + 6000, month, day)
    year = property(lambda self: self._date.year - 6000)
    month = property(lambda self: self._date.month)
    day = property(lambda self: self._date.day)

    def weekday(self): self._date.weekday
    ...

    d = RothDate(-200, 2, 10)
    print d.year, d.month. d.day
    print d.weekday()


    Andrew
    Andrew Dalke, Aug 4, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben S
    Replies:
    16
    Views:
    738
    John Roth
    Aug 4, 2003
  2. Ben S
    Replies:
    2
    Views:
    308
    Steven Taschuk
    Aug 1, 2003
  3. Tim Peters

    RE: time, calendar, datetime, etc

    Tim Peters, Aug 2, 2003, in forum: Python
    Replies:
    3
    Views:
    300
    John Roth
    Aug 3, 2003
  4. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    704
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  5. Tim Peters
    Replies:
    0
    Views:
    532
    Tim Peters
    Sep 9, 2003
Loading...

Share This Page