<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 8, 2015 at 6:45 PM, Antoine Pitrou <span dir="ltr"><<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Thu, 8 Jan 2015 17:01:03 +0100<br>
Todd <<a href="mailto:toddrjen@gmail.com" target="_blank">toddrjen@gmail.com</a>> wrote:<br>
> Currently, the range class is limited to integers.  However, in many<br>
> applications, especially science and mathematics, ranges of float values<br>
> are the norm.<br>
><br>
> The current approaches for float ranges all have significant limitations.<br>
> numpy.arange pre-allocates the values and doesn't use python floats, both<br>
> of which affect performance.  List comprehensions also have to be<br>
> pre-allocated.  Generators and values created in the body of a loop cannot<br>
> be indexed or re-used and are much more verbose and harder to read.  So it<br>
> would be nice to have a float equivalent of the existing range class.<br>
<br>
</span>What use do you have for a lazily allocated floating-point range?<br>
<br>
Regards<br>
<span><font color="#888888"><br>
Antoine.<br>
</font></span><div><div><br></div></div></blockquote><div><br></div><div>The most common use-case is similar to the existing range: looping or iterating over values needed for some computation.  This can become much more complicated, however, in many numerical algorithms where the exact order of the values you access cannot be known beforehand.  You can save a huge amount of memory by not pre-allocating an array of such values, but that requires making the range indexable.<br></div></div><br></div></div>