R
Robert Brewer
Anyone else tired of typing date-addition logic when iterating? It would
be nice if the datetime package had something like:
def iterdates(first, last):
for day in range((last - first).days + 1):
yield first + datetime.timedelta(day)
....notice the inclusive boundaries (i.e. last gets returned). This
simple construct would make ugly date loops a lot cleaner:
for day in datetime.iterdates(first_date, last_date):
do_something_with(day)
Robert Brewer
MIS
Amor Ministries
(e-mail address removed)
be nice if the datetime package had something like:
def iterdates(first, last):
for day in range((last - first).days + 1):
yield first + datetime.timedelta(day)
....notice the inclusive boundaries (i.e. last gets returned). This
simple construct would make ugly date loops a lot cleaner:
for day in datetime.iterdates(first_date, last_date):
do_something_with(day)
Robert Brewer
MIS
Amor Ministries
(e-mail address removed)