A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088800.html below:

[Python-Dev] Issue5434: datetime.monthdelta

[Python-Dev] Issue5434: datetime.monthdeltaDirkjan 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4