[Python-Dev] range objects in 3.x

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Sep 27 18:36:52 CEST 2011


On Tue, Sep 27, 2011 at 12:20 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> If it happened
> to support dates, that would be great, but I think that a daterange()
> function in the datetime module would be more appropriate.

Or even more appropriately in the calendar module.  The problem is
that we may already have a similar function there and nobody knows
about it.

> Who is going to
> think to import math if you want a range of dates?

No one.  That's why I said that if the new function ends up in math or
stats, I am +1 on frange().  However, I did in the past try to give
dates for start and stop and a timedelta for step expecting range() to
work.  This would be similar to the way sum works for non-numeric
types when an appropriate start value is given.

BTW, at the time when I worked on extending (x)range to long integers,
I attempted to make it work on dates, but at that time timedelta did
not support division by integer, so I refocused on that instead.


More information about the Python-Dev mailing list