How to add months to a date (datetime object)?

John Yeung gallium.arsenide at gmail.com
Mon Mar 16 02:01:53 CET 2009


On Mar 15, 7:26 pm, Chris Rebert <c... at rebertia.com> wrote:
> [...] the point is that there are likewise reasonable usecases
> for the other behaviors too and one should refuse to guess in
> the face of ambiguity; the std lib has, merely by default in
> this case, taken this to the extreme of not implementing any
> of them directly.
>
> Somewhat unrelated wish: if only dateutil were in the std
> lib... Alas!

dateutil makes a very clear choice about the behavior of month
arithmetic (namely, the one which the OP was after).  Has it not
"guessed in the face of ambiguity"?

Personally, I don't think OP's original phrasing of the problem was
too ambiguous.  I agree there are other reasonable interpretations,
but I disagree that his intention was unclear.  His intention matches
what I believe to be the prevailing one; thus I don't find dateutil's
choice to be much of a guess.

John



More information about the Python-list mailing list