[NumPy-Tickets] [NumPy] #1687: Example in documentation on default iteration in incorrect

NumPy Trac numpy-tickets@scipy....
Sat Nov 27 09:23:33 CST 2010


#1687: Example in documentation on default iteration in incorrect
---------------------------+------------------------------------------------
 Reporter:  gerrit         |       Owner:  pv   
     Type:  defect         |      Status:  new  
 Priority:  normal         |   Milestone:  1.5.2
Component:  Documentation  |     Version:  devel
 Keywords:                 |  
---------------------------+------------------------------------------------
 According to

 http://docs.scipy.org/doc/numpy/reference/arrays.classes.html#default-
 iteration

 ''The default behavior [of ''for val in arr''] is equivalent to:''

 {{{
 for i in arr.shape[0]:
     val = arr[i]
 }}}

 This cannot be correct, because arr.shape[0] is an int and not iterable.
 Correct is:

 {{{
 for i in xrange(arr.shape[0]):
     val = arr[i]
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1687>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list