[Python-ideas] Float range class

Antoine Pitrou solipsis at pitrou.net
Thu Jan 8 18:45:16 CET 2015


On Thu, 8 Jan 2015 17:01:03 +0100
Todd <toddrjen at gmail.com> wrote:
> Currently, the range class is limited to integers.  However, in many
> applications, especially science and mathematics, ranges of float values
> are the norm.
> 
> The current approaches for float ranges all have significant limitations.
> numpy.arange pre-allocates the values and doesn't use python floats, both
> of which affect performance.  List comprehensions also have to be
> pre-allocated.  Generators and values created in the body of a loop cannot
> be indexed or re-used and are much more verbose and harder to read.  So it
> would be nice to have a float equivalent of the existing range class.

What use do you have for a lazily allocated floating-point range?

Regards

Antoine.




More information about the Python-ideas mailing list