[Numpy-discussion] Time for beta1 of NumPy 1.0

Robert Kern robert.kern at gmail.com
Fri Jun 30 16:02:28 EDT 2006


Christopher Barker wrote:
> Robert Kern wrote:
>> Whatever else you do, leave arange() alone. It should never have accepted floats 
>> in the first place.
> 
> Just to make sure we're clear: Because one should use linspace() for that?

More or less. Depending on the step and endpoint that you choose, it can be 
nearly impossible for the programmer to predict how many elements are going to 
be generated.

> If so, this would be the time to raise an error (or at least a 
> deprecation warning) when arange() is called with Floats.
> 
> I have a LOT of code that does that! In fact, I posted a question here 
> recently and got a lot of answers and suggested code, and not one person 
> suggested that I shouldn't use arange() with floats.

I should have been more specific, but I did express disapproval in the code 
sample I gave:

   x = arange(minx, maxx+step, step)  # oy.

Since your question wasn't about that specifically, I used the technique that 
your original sample did.

> Did Numeric have linspace() It doesn't look like it to me.

It doesn't. It was originally contributed to Scipy by Fernando, IIRC. It's 
small, so it is easy to copy if you need to maintain support for Numeric, still.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco





More information about the NumPy-Discussion mailing list