[Python-Dev] Issue5434: datetime.monthdelta
Dirkjan Ochtman
dirkjan at ochtman.nl
Thu Apr 16 12:16:15 CEST 2009
On Thu, Apr 16, 2009 at 11:54, Amaury Forgeot d'Arc <amauryfa at gmail.com> wrote:
> In my opinion:
> arithmetic with months is a mess. There is no such "month interval" or
> "year interval" with a precise definition.
> If we adopt some kind of month manipulation, it should be a function
> or a method, like you would do for features like last_day_of_month(d),
> or following_weekday(d, 'monday').
>
> date(2008, 1, 30).add_months(1) == date(2008, 2, 29)
I concur. Trying to shoehorn month arithmetic into timedelta is a
PITA, precisely because it's somewhat inexact. It's better to have
some separate behavior that has well-defined behavior in edge cases.
Cheers,
Dirkjan
More information about the Python-Dev
mailing list