Robert Brewer fumanchu at
Mon Jul 12 03:57:19 CEST 2004

I wrote:
> > 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):

and Tim Peters replied:
> I'm not a fan of building in every function that can (as you just
> showed) be written easily in a couple lines of Python...
> I've noted before that I've not enountered another language community
> so eager to bloat the language with things they can trivially do on
> their own.  What's up with that?  I personally find Python functions
> pretty easy to write -- even four-liners <wink>.

I understand and agree with your assessment in general; I obviously feel
this specific one is worthwhile--it's too common of an idiom (coupled
with extremely ugly syntax) to ignore. Makes you wonder why dict.update
ever got included... ;)

> If something like this ever is built in, it
> certainly won't be inclusive of the endpoint --
> that's too jarringly different from range().

I would agree if there were a daterange object (a sequence) which you
would then use the output to index into. Hmmm. Maybe that's a better
approach anyway.

Heck, I'd rather just have:

>>>, 5, 1) + 1, 5, 2)

...but I figured that would be a harder fight. :)

Robert Brewer
Amor Ministries
fumanchu at

More information about the Python-list mailing list