[Numpy-discussion] Time for beta1 of NumPy 1.0

Robert Kern robert.kern at gmail.com
Fri Jun 30 15:54:30 EDT 2006


Scott Ransom wrote:
> On Fri, Jun 30, 2006 at 01:25:23PM -0600, Travis Oliphant wrote:
>> Robert Kern wrote:
>>
>>> Whatever else you do, leave arange() alone. It should never have accepted floats 
>>> in the first place.
>>>  
>> Actually, Robert makes a good point.  arange with floats is 
>> problematic.   We should direct people to linspace instead of changing 
>> the default of arange.  Most new users will probably expect arange to 
>> return a type similar to Python's range which is int.
> ... 
>> So, I think from both a pragmatic and idealized situtation, arange 
>> should stay with the default of ints.   People who want arange to return 
>> floats should be directed to linspace.
> 
> I agree that arange with floats is problematic.  However,
> if you want, for example, arange(10.0) (as I often do), you have
> to do: linspace(0.0, 9.0, 10), which is very un-pythonic and not
> at all what a new user would expect...
> 
> I think of linspace as a convenience function, not as a
> replacement for arange with floats.

I don't mind arange(10.0) so much, now that it exists. I would mind, a lot, 
about arange(10) returning a float64 array. Similarity to the builtin range() is 
much more important in my mind than an arbitrary "consistency" with ones() and 
zeros().

It's arange(0.0, 1.0, 0.1) that I think causes the most problems with arange and 
floats.

-- 
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