[Python-Dev] range objects in 3.x

Ethan Furman ethan at stoneleaf.us
Tue Sep 27 18:27:34 CEST 2011


Steven D'Aprano wrote:
> 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?

If it's generic, why should it live in math?

~Ethan~


More information about the Python-Dev mailing list