[portland] Clue Stick Needed

Rich Shepard rshepard at appl-ecosys.com
Wed Jan 16 23:26:24 CET 2008

   I am embarrassed to have to ask for help on this issue, but I'm just not
seeing how to accomplish the task.

   Selected from a database table is a list of tuples; each tuple I call a
'row' of category names. Each name has from 1 to 7 subunits, and its
sequential number is in row[5]. The total number of subunits is row[16].
Both row[5] and row[16] are integers.

   What I need to do is go through the list of rows and isolate the items, in
sequential order, grouped by names. In C I would write 'for i=0, i<row[16],
i++', but what I thought would be the Python equivalent, 'for i < row[16]',
is not valid. If I try a nested while loop, it hangs on the first item of
the first variable.

   This is obviously a very basic and simple task but how to do it keeps
eluding me. This is how I've started the function:

 	for i in range(len(self.appData.tsets)):
 	      row = self.appData.tsets[i]
 	      # select component, subcomponent, variable names
 	      curComp = row[3]
 	      curSub = row[2]
 	      curVar = row[1]
 	      tb.x += 9
 	      if row[2] == '':
 	        tb.x += 36
 	      tb.x += 9
 	      # set up for plotting
... and it's here that I want to extract each item in sequential order, up
to the maximum number, represented in row[16].


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