Some thoughts about this relativedelta stuff: Isn't the name "relativedelta" somewhat superfluouslyredundant? The word "delta" already implies something relative. (It's also ratherhardtoread.) > >>> d > datetime.datetime(2004, 4, 4, 0, 0) > >>> d+relativedelta(month=1) > datetime.datetime(2004, 1, 4, 0, 0) So a relativedelta can affect things in a way that's not relative at all? That sounds *very* confusing. Wouldn't it be better if relativedelta confined itself to relative things only, and provide some other way of absolutely setting fields of a date? > MO(0) shouldn't be used as it makes no sense, but is the same > as MO(+1) which is the same as MO(1). So there is a hole at 0. Something about that smells wrong. > The expected type [of leapdays] is an integer. This is mainly used > to implement nlyearday. Would a value other than 0 or 1 ever make sense for this? I'm having a hard time imagining how it could -- but maybe my imagination isn't twisted enough... > > Is it true that adding relativedelta(months=+1) 12 times isn't necessarily > > the same as adding relativedelta(years=+1) once? > > They land on the same date. While the documentation looks somewhat > confusing, the implementation is not. For example: > > >>> date(2000,2,29)+relativedelta(months=+12) > datetime.date(2001, 2, 28) I think the OP's question was what happens if you do for i in range(12): d += relativedelta(months=+1) 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 +--------------------------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4