[Python-Dev] dateutil

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Mar 17 19:07:51 EST 2004


Jewett, Jim J" <jim.jewett at EDS.COM>:

> Do you add weeks to the current day, or to the "start"
> of the current week?
> 
> M	T[1]	W	Th[2]	F 
> M	T	W	Th	F 
> M	T[3]	W	Th[4]	F 
> M	T[5]	W	Th	F 

It doesn't matter. If we start from T[1] and do

  relativedelta(day = TH, weeks = +2)

then if we go to the next Thursday (Th[2]) and then forward
two weeks, we get Th[4]. If we go forward two weeks to
T[3] and then to the next Thursday, we still get Th[4].

> If so, does starting at Th[2] and asking for Tuesday take you to
> T[3] or T[5]?

A mechanism is still needed to distinguish between going forwards
and backwards when aligning the day. Maybe day=+TU or day=-TU.

All I'm saying is that munging a number of weeks in with 'day'
seems to lead to a confusing overlap of functionality with the
'weeks' parameter. The reader is likely to wonder why there
are two different ways of adding/subtracting weeks and whether
there is some subtle difference between them.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+
				   



More information about the Python-Dev mailing list