[Python-Dev] RE: Python-Dev digest, Vol 1 #1124 - 13 msgs

Greg Wilson gvwilson@ca.baltimore.com
Mon, 29 Jan 2001 14:38:50 -0500

> Greg Wilson writes:
>  > This would allow multi-dimensional structures
>  > (e.g. NumPy arrays) to do things like:
>  >     for (i, j, k) in array:
>  > and:
>  >     for ((i, j, k), v) in array:	# three indices and value

> Charles Waldman asks:
> And what if I had, for example, a 3-dimensional array where the values
> are 3-tuples?  Would "for (i,j,k) in array" refer to the 
> indices or the values?

Greg Wilson writes:
That would be up to the module's implementer --- my idea was to have
the 'for' loop provide more information to the object being iterated
over, so that it could "do the right thing" (just as objects do right
now with "x[i]").