[Python-Dev] dateutil

Gustavo Niemeyer niemeyer at conectiva.com
Tue Mar 16 09:26:42 EST 2004


> I don't know. The problem here is that it is not obvious what is going
> to happen. Consider:
> 
> d1 = date(2004, 1, 31)
> d2 = date(2004, 1, 28)
> 
> d1_1 = d1 + relativedelta(months=1)
> d2_1 = d2 + relativedelta(months=1)

It's obvious to me, and should be obvious to anyone who knows the
behavior of this class. They'll land on Feb/29 and Feb/28,
respectively.

> If you subscribe to d1_1 == d2_1, what do you expect to be the result
> of:

Why would I 'subscribe' to that?

> d1_1 + relativedelta(months=1)
> d2_1 + relativedelta(months=1)
> 
> Whatever you choose it will be seriously inconsistent from one point
> of view or another.

They'll land on Mar/29 and Mar/28? Where's the incosistency!?

-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the Python-Dev mailing list