[Python-Dev] dateutil (original) (raw)

Brett C. bac at OCF.Berkeley.EDU
Thu Mar 11 16:04:26 EST 2004


Tim Peters wrote:

[Gerrit] <SNIP - use case of a date two weeks from one and my bumbling attempt at doing it with the stdlib as it stand now>

I'm not grasping the perceived difficulty with this specific use case:

import datetime datetime.date(2004, 2, 24) + datetime.timedelta(weeks=2) datetime.date(2004, 3, 9) I suppose it's possible that Gerrit finds "relativedelta" easier to type for some reason .

=)

Before I give my vote on DateUtil I know I would love to hear Gustavo give a quick comparison to datetime in terms of what DateUtil provides over datetime. For instance, as Tim showed above (I should have known there was a better way with datetime than with my nutty way of doing it), datetime supports time deltas. So why should we use DateUtil's or what should we try to take from it? Same for parser (compared to strptime) and tz (compared to tzinfo). I could obviously stare at the wiki and datetime docs, but I am sure Gustavo can give a better overview than I could glean on my own.

The rrule idea does sound cool and could be neat to add to datetime. I can see having an iterator for these things being useful to someone (unless I am making myself partially look like a fool again by having this be in datetime already without me realizing it).

-Brett



More information about the Python-Dev mailing list