[Numpy-discussion] Time for beta1 of NumPy 1.0

Scott Ransom sransom at nrao.edu
Fri Jun 30 15:44:38 EDT 2006


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.

Scott

-- 
Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom at nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989




More information about the NumPy-Discussion mailing list