[Python-Dev] Issue5434: datetime.monthdelta

Jess Austin jess.austin at gmail.com
Thu Apr 16 20:50:29 CEST 2009


On Thu, Apr 16, 2009 at 5:16 AM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
> 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.

This is my experience also, and including a distinct and well-defined
behavior in the core is exactly my intention with this patch.


More information about the Python-Dev mailing list