[NumPy-Tickets] [NumPy] #1864: arange using float for step and integer dtype results in an array with all values being the same

NumPy Trac numpy-tickets@scipy....
Tue Jun 14 18:35:35 CDT 2011


#1864: arange using float for step and integer dtype results in an array with all
values being the same
------------------------+---------------------------------------------------
 Reporter:  bsouthey    |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  devel      
 Keywords:              |  
------------------------+---------------------------------------------------

Comment(by derek):

 Actually it seems to construct something like np.arange(int(start),
 int(stop), int(step)), although the length remains the same as for the
 float array - compare
 {{{
 >>>np.arange(0,5,1.5, dtype=int)
 array([0, 1, 2, 3])
 }}}
 np.arange().astype(int) would produce what you may expect, but I'm not
 sure if this should be considered a feature or a bug. It provides
 something neither np.arange(int(start), int(stop), int(step)) nor
 np.arange(start, stop, step).astype(int) could construct, though I cannot
 think of any situation where one could use this...

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1864#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list