[portland] Iterating Through Tuples In A List

Rich Shepard rshepard at appl-ecosys.com
Fri Feb 15 21:58:03 CET 2008


On Fri, 15 Feb 2008, Dylan Reinhardt wrote:

> Unless you *really* want to set self.row, I might do this instead:

Dylan,

   Only because it's referenced from several functions within the module.

> The second element of each tuple is another tuple.  One way you might
> manipulate this is:
>
> for row in mytup:
>    print row[0]
>    for inner in row[1]:
>        print ' - ', inner
>
> That's pretty trivial, but it shows iterating over sub-collections of
> unequal length.  Hopefully part of that answers your question.

   Ah! That I should have known. Let me work with this and put it into my
context.

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863


More information about the Portland mailing list