[Python-ideas] Float range class

Todd toddrjen at gmail.com
Fri Jan 9 11:20:32 CET 2015

On Thu, Jan 8, 2015 at 7:40 PM, Nathaniel Smith <njs at pobox.com> wrote:

> On Thu, Jan 8, 2015 at 5:58 PM, Todd <toddrjen at gmail.com> wrote:
> > On Thu, Jan 8, 2015 at 6:41 PM, Andrew Barnert <abarnert at yahoo.com>
> wrote:
> >>
> >> More generally: if an frange that works exactly like range but with
> floats
> >> (and rounding errors) is all you want, that's so trivial to write that
> it
> >> doesn't seem worth putting in the stdlib, unless the use case is very
> >> common.
> >
> > In numerical computing the use-case is extremely common, in fact I would
> say
> > it practically universal.  Ideally it would be vectorized, but in
> practice
> > this is often not possible, requiring the use of loops.
> Can you give a more specific example? I believe your problem is real,
> but as a numerical programmer I can't think of an example of where
> I've ever wanted anything like this, so it's hard for me to visualize
> what exactly you're talking about.

Here is one right from the scipy cookbook:
But in practice, it would be any case where a range of values are needed,
and you can't vectorize for whatever reason (such as having mutable values,
needing to do things out of order, or relying on some arbitrary data set).

Some other examples:
1. Anything done in parallel on a range of values (here is an example,
although they don't give the actual algorithm
2. Using individual floats as inputs to another program or library (I am
doing this right now for simulation, I only use numpy because it is the
only easy way to get the ranges I need)
3. Many types a stair step adaptive approaches in experiments (
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150109/eb7e6471/attachment.html>

More information about the Python-ideas mailing list