[Python-Dev] dateutil

Aahz aahz at pythoncraft.com
Mon Mar 15 19:28:05 EST 2004


On Tue, Mar 16, 2004, Greg Ewing wrote:
> Gustavo Niemeyer <niemeyer at conectiva.com>:
>> 
>> (just as examples)
>> 
>> d + relativedelta(day=1)
>> d + relativedelta(day=31)
> 
> Sorry, but the more I see of this usage the worse it looks. Here
> you're effectively using '+' as an assignment operator. To me, that's
> a gross abuse of the Python language.

Part of the problem is that relativedelta does need to be a single
complex object.  Consider

today() + relativedelta(month=1, dayofweek=FRIDAY)

contrasted with

today() + relativedelta(weeks=4, dayofweek=FRIDAY)

Humans use complex relative date constructs, and many of them depend on
whatever the base time is; in order to do the adjustment correctly, you
need to provide a single change construct.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"usenet imitates usenet"  --Darkhawk



More information about the Python-Dev mailing list