[portland] Clue Stick Needed

Rich Shepard rshepard at appl-ecosys.com
Thu Jan 17 00:54:02 CET 2008

On Wed, 16 Jan 2008, Rich Shepard wrote:

>   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.

   I think that I'm making progress, but I'm still not there. Here's the
relevant portion of the function:

 	proper = lambda t: (t[3],t[2], t[1], t[0], t[5])
         sorted(self.appData.tsets, key=proper)
 	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
 	        for i in range(7):
 	        if i == row[16]:
 			print curVar, row[0], row[5], row[4]

   This throws no errors, but the resulting list is still not in order:

 	FloodControl Poor 1 Left Shoulder
 	FloodControl Average 2 Trapezoid
 	AnimalRefugia Poor 1 Left Shoulder
 	AnimalRefugia High 3 Right Shoulder
 	FloodControl High 3 Right Shoulder
 	AnimalRefugia Adequate 2 Trapezoid

   The third FloodControl should follow the second one. Is my syntax error


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