This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: datetime.monthdelta
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.1
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: adamnelson, belopolsky, cvrebert, jess.austin, lemburg, tim.peters
Priority: normal Keywords: patch

Created on 2009-03-07 05:04 by jess.austin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
monthdelta.py jess.austin, 2009-03-11 21:39 prototype implementation in python
monthdelta3.diff jess.austin, 2009-04-23 04:32 unified patch on py3k
Messages (10)
msg83272 - (view) Author: Jess Austin (jess.austin) Date: 2009-03-07 05:04
datetime is a wonderful module.  Perhaps the only inconvenient aspect of
using it is dealing with month calculations and comparisons.  This patch
adds a simple class, monthdelta, which represents date offsets in terms
of months.  It supports basic integer-like arithmetic, and also it may
be added to dates and datetimes.  It deals sensibly with leap-year and
month-length issues.  Also provided is a function, monthmod (named by
imperfect analogy to divmod), which allows round-tripping: that is,
taking 2 dates and returning a (monthdelta, timedelta) tuple that
represents the interim between the dates.

Note: I have named the class "monthdelta", but in light of recent
python-dev discussions I should probably rename this to "MonthDelta".
msg83273 - (view) Author: Jess Austin (jess.austin) Date: 2009-03-07 05:24
This is my first try at a patch.  All functionality, tests, and
documentation are included, but I won't be surprised if I need to make
some changes!  Please let me know.
msg83275 - (view) Author: Jess Austin (jess.austin) Date: 2009-03-07 05:59
Rietveld link: http://codereview.appspot.com/25079
msg83480 - (view) Author: Jess Austin (jess.austin) Date: 2009-03-11 21:39
This prototype python implementation passes the same tests that the C
implementation in the patch does (modulo import differences).  I'll
probably backport this for 2.x versions.
msg84114 - (view) Author: Jess Austin (jess.austin) Date: 2009-03-24 20:33
With the rejection of Issue 5530, it seems best for the name of this
class to remain lowercase.  Mixing casing schemes within the same module
would be perverse.
msg86323 - (view) Author: Jess Austin (jess.austin) Date: 2009-04-22 20:02
The backport through python 2.3 is up at PyPI:
http://pypi.python.org/pypi?name=MonthDelta&:action=display

Download source and install, or just easy_install.  Documentation is
also linked at PyPI.
msg106495 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-05-26 00:22
MonthDelta has been published on PyPI and there was no activity on this issue since then. I conclude that there is little support for including this in stdlib.  I am marking this as "rejected" and setting the status to pending.  I will close this issue in a few weeks unless I hear objections. 

Jess,

I see that your package is healthy on PyPI with over 700 downloads for the latest version.  Note that some additional operations have been added recently to timedelta object and more are in the works.  You may want to consider adding them to the next version of your package.  (See issue 1289118 and issue 2706.)
msg106846 - (view) Author: Jess Austin (jess.austin) Date: 2010-06-01 16:40
Yeah, the masses have spoken, and their silence is deafening.  I was going to downplay the "health" of the package based on the number of downloads, but then I looked at the "futures" page.  b^)  Seriously, getting this in would require a core developer wanting it in, and at this point it seems none do.

On the subject of float operations, while there may be some question about the integerness or floatness of timedelta, monthdelta is definitely an integer.  As monthdelta already supports multiplication by integers and floor division by integers or monthdeltas, I don't see anything missing.  To use monthdeltas with floats is to miss the point entirely.
msg106906 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-06-02 18:14
Rejecting this for stdlib.  A 3rd party package is available at http://pypi.python.org/pypi?name=MonthDelta&:action=display .
msg125955 - (view) Author: AdamN (adamnelson) Date: 2011-01-10 23:35
For future reference, python-dateutil seems like the maintained way to deal with "human" dates outside of the stdlib.

http://pypi.python.org/pypi/python-dateutil
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49684
2011-01-10 23:35:14adamnelsonsetnosy: + adamnelson
messages: + msg125955
2010-06-02 18:14:41belopolskysetstatus: pending -> closed

messages: + msg106906
stage: resolved
2010-06-01 19:08:26jess.austinsetstatus: open -> pending
2010-06-01 16:40:16jess.austinsetstatus: pending -> open

messages: + msg106846
2010-05-26 00:22:22belopolskysetstatus: open -> pending

nosy: + belopolsky
messages: + msg106495

assignee: belopolsky
resolution: rejected
2009-04-23 04:34:47jess.austinsetfiles: - monthdelta2.diff
2009-04-23 04:33:29jess.austinsetfiles: + monthdelta3.diff
2009-04-22 20:02:09jess.austinsetmessages: + msg86323
2009-04-21 19:02:43cvrebertsetnosy: + cvrebert
2009-04-16 05:38:21jess.austinsetfiles: - monthdelta.diff
2009-04-16 05:37:30jess.austinsetfiles: + monthdelta2.diff
2009-03-24 20:33:05jess.austinsetmessages: + msg84114
title: datetime.MonthDelta -> datetime.monthdelta
2009-03-12 20:56:18jess.austinsetfiles: - datetimemodule.diff
2009-03-12 20:54:51jess.austinsetfiles: + monthdelta.diff
2009-03-11 21:39:44jess.austinsetfiles: + monthdelta.py

messages: + msg83480
2009-03-07 10:25:05pitrousetnosy: + lemburg, tim.peters
2009-03-07 05:59:38jess.austinsetmessages: + msg83275
2009-03-07 05:24:46jess.austinsetfiles: + datetimemodule.diff
keywords: + patch
messages: + msg83273
2009-03-07 05:04:48jess.austincreate