[Numpy-tickets] [NumPy] #1025: Incorrect documentation for put function

NumPy numpy-tickets@scipy....
Wed Feb 25 01:23:48 CST 2009


#1025: Incorrect documentation for put function
-------------------------------+--------------------------------------------
 Reporter:  afoglia            |        Owner:  somebody
     Type:  defect             |       Status:  new     
 Priority:  normal             |    Milestone:  1.3.0   
Component:  numpy.core         |      Version:  none    
 Severity:  minor              |   Resolution:          
 Keywords:  put documentation  |  
-------------------------------+--------------------------------------------
Comment (by ScottSinclair):

 Thanks for the report, the current documentation is incorrect. It would be
 great if you worked on this docstring in the doc-wiki

 http://docs.scipy.org/numpy/Front%20Page/

 Register at:

 http://docs.scipy.org/numpy/accounts/register/

 I note that the code you suggest does not correctly describe the behaviour
 of np.put for the case where the number of values is less than the number
 of indices.

 {{{
 >>> a = np.arange(5)
 >>> indices = [0, 2, 4]
 >>> values = [-1, -2]
 >>> np.put(a, indices, values)
 >>> a
 array([-1,  1, -2,  3, -1])
 >>> a = np.arange(5)
 >>> for i, v in zip(indices, values): a.flat[i] = v
 >>> a
 array([-1,  1, -2,  3,  4])
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/1025#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list