[Numpy-discussion] Multiarray PEP: iterators

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Fri Feb 18 09:51:19 CST 2005


The PEP says:

   Iterator

       An iterator will be defined that will walk through any array,
       returning a rank-0 array at each step.  Rank-0 arrays act like
       the appropriate Python scalar and will be converted to one
       whenever Python asks the object explicitly to try and do so.
       Order of the iteration is the same for contiguous and
       discontiguous arrays.  The last index always varies the fastest


At the moment, iteration over a rank-N array yields rank-(N-1) arrays 
(indexing along the first dimension). I consider this vastly more 
useful than iterating over the rank-0 elements and thus ignoring the 
array structure completely.

Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Laboratoire Léon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: hinsen at llb.saclay.cea.fr
---------------------------------------------------------------------





More information about the Numpy-discussion mailing list