[Python-Dev] dateutil

Gustavo Niemeyer niemeyer at conectiva.com
Wed Mar 17 14:22:59 EST 2004


> >Supporting this might be cool indeed. OTOH, it doesn't replace the
> >current behavior. How do you get (day=30)?
> 
> day=30 is simply '30th day of the month'.
> 
> day=-2 is '2nd last day of the month'.
> 
> The negative simply means 'count from the end', as it does with Python 
> indexing. This would indeed be useful, and far more obvious than 
> 'day=31' and relying on the 'use maximum day in month' feature.

Thanks for explaining that. OTOH, that's exactly what I meant
in the sentence above. Negative indexing is nice, but doesn't
replace the current behavior. Please, have a look at the other
messages to understand why.

> The other question I had was why is there no absolute 'week'
> parameter?  to get 'week 43', it is necessary to say 'month=1, day=1,
> weeks=43'.

Because there's no simple definition of what is "week 43". The ISO
notation requires other parameters, like first week day, which is not
covered in relativedelta. If you want to deal with week numbering,
please have a look at rrule.

-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the Python-Dev mailing list