Status of PEP's?

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Mar 3 20:08:44 EST 2002


"Hernan M. Foffani" wrote:
> 
> But I fail to see how to apply this solution naturally on sets that have
> several different main 'walking' directions like arrays or like the sample
> in the PEP. If the 'table' object has symmetry between two (or more) axes,
> then
>         indici(table)
> is ambiguous.

An optional second argument indicating which dimension 
you want the indices for.

  for i in indices(myarray, 0):
    for j in indices(myarray, 1):
      ...

or for more abstract notions of dimension:

  for i in indices(mytable, "rows"):
    for j in indices(mytable, "cols"):
      ...

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list