[Python-Dev] Issue5434: datetime.monthdelta

Steven D'Aprano steve at pearwood.info
Fri Apr 17 04:42:45 CEST 2009

On Fri, 17 Apr 2009 07:47:14 am Antoine Pitrou wrote:
> Jess Austin <jess.austin <at> gmail.com> writes:
> > What other behavior options besides "last-valid-day-of-the-month"
> > would you like to see?
> IMHO, the question is rather what the use case is for the behaviour
> you are proposing. In which kind of situation is it acceptable to
> turn 31/2 silently into 29/2?

Any time the user expects "one month from the last day of January" to 
mean "the last day of February". I dare say that if you did a poll of 
non-programmers, that would be a very common expectation, possibly the 
most common.

I just asked the missus, who is a non-programmer, what date is one month 
after 31st January and her answer was "2rd of March on leap years, 
otherwise 3rd of March".

Steven D'Aprano

More information about the Python-Dev mailing list