Re: [Python-ideas] [Python-Dev] Issue5434: datetime.monthdelta

On Thu, Apr 16, 2009 at 4:50 PM, Eric Smith <eric@trueblade.com> wrote:
Jess Austin wrote:
What other behavior options besides "last-valid-day-of-the-month" would you like to see?
- Add 30 days to the source date. I'm sure there are others.
Python can do this already: dt + timedelta(30)
Followups to python-ideas.
This is fine with me, and I have joined -ideas now. I do still hope that an experienced core developer will have the time to comment on the code itself, but it might be best to get discussion of alternate functionality off -dev. cheers, Jess

On Thu, Apr 16, 2009 at 3:35 PM, Jess Austin <jess.austin@gmail.com> wrote:
On Thu, Apr 16, 2009 at 4:50 PM, Eric Smith <eric@trueblade.com> wrote:
Jess Austin wrote:
What other behavior options besides "last-valid-day-of-the-month" would you like to see?
- Add 30 days to the source date. I'm sure there are others.
Python can do this already:
dt + timedelta(30)
Followups to python-ideas.
You might want to look at this recent thread on the issue: http://mail.python.org/pipermail/python-list/2009-March/704921.html Apologies if it's already been mentioned on -dev; I don't subscribe to it. Cheers, Chris -- I have a blog: http://blog.rebertia.com

On Thu, Apr 16, 2009 at 5:41 PM, Chris Rebert <pyideas@rebertia.com> wrote:
You might want to look at this recent thread on the issue: http://mail.python.org/pipermail/python-list/2009-March/704921.html
Apologies if it's already been mentioned on -dev; I don't subscribe to it.
Haha, and up until now I haven't subscribed to -ideas. It seemed the main complaint in the previous thread was that there are different ways to handle the corner case of the end of the month, and we certainly can't just choose one way. My take on that is that if you want an exception for invalid dates, use date.replace(). If you want an exact number of days offset, use timedelta. If you want the same date, some number of months offset, while month-end issues are silently handled, you can use the monthdelta patch I have at http://bugs.python.org/issue5434 and introduce at http://mail.python.org/pipermail/python-dev/2009-April/088794.html . I'm also aware of dateutil, but in its current form it couldn't be integrated into core as "batteries included". IMHO dateutil isn't as pythonic as it could be either. My philosophy when designing this was to be as much like timedelta (which I think is a super API) as possible. cheers, Jess

On Thu, Apr 16, 2009 at 6:32 PM, Jess Austin <jess.austin@gmail.com> wrote:
My take on that is that if you want an exception for invalid dates, use date.replace(). If you want an exact number of days offset, use timedelta. If you want the same date, some number of months offset, while month-end issues are silently handled, you can use the monthdelta patch I have at http://bugs.python.org/issue5434 and introduce at http://mail.python.org/pipermail/python-dev/2009-April/088794.html
I've uploaded the backported python version source distribution to PyPI, http://pypi.python.org/pypi?name=MonthDelta&:action=display with better-formatted documentation at http://packages.python.org/MonthDelta/ "easy_install MonthDelta" works too. cheers, Jess

Good doco! -T On Thu, Apr 23, 2009 at 6:59 AM, Jess Austin <jess.austin@gmail.com> wrote:
On Thu, Apr 16, 2009 at 6:32 PM, Jess Austin <jess.austin@gmail.com> wrote:
My take on that is that if you want an exception for invalid dates, use date.replace(). If you want an exact number of days offset, use timedelta. If you want the same date, some number of months offset, while month-end issues are silently handled, you can use the monthdelta patch I have at http://bugs.python.org/issue5434 and introduce at http://mail.python.org/pipermail/python-dev/2009-April/088794.html
I've uploaded the backported python version source distribution to PyPI, http://pypi.python.org/pypi?name=MonthDelta&:action=display with better-formatted documentation at http://packages.python.org/MonthDelta/
"easy_install MonthDelta" works too.
cheers, Jess _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
-- -------------------------------------------------- Tennessee Leeuwenburg http://myownhat.blogspot.com/ "Don't believe everything you think"
participants (3)
-
Chris Rebert
-
Jess Austin
-
Tennessee Leeuwenburg