[Python-Dev] range objects in 3.x

Steven D'Aprano steve at pearwood.info
Tue Sep 27 18:20:27 CEST 2011


Alexander Belopolsky wrote:

> In addition to Steven's criticisms of numpy.linspace(), I would like a
> new function to work with types other than float.  It certainly makes
> sense to have range-like functionality for fractions and decimal
> floats, but also I often find a need to generate a list of equally
> spaces dates or datetime points.  It would be nice if a new function
> would allow start and stop to be any type that supports subtraction
> and whose differences support division by numbers.

I think a polymorphic numeric range function would be useful. 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. 
Who is going to think to import math if you want a range of dates?


-- 
Steven



More information about the Python-Dev mailing list