[portland] Need Help With a For Loop
Rich Shepard
rshepard at appl-ecosys.com
Thu Mar 20 19:09:23 CET 2008
On Thu, 20 Mar 2008, Brett Carter wrote:
> Rich, are you sure this loop is doing what you want it to?
Brett,
I'm sure it's _not_ doing what I want. :-(
> You're incrementing i 'range(1, compList[0][16])' times, but i is never
> tested in the loop.
True. The logic is FUBAR.
Rather than 'i', what I want to use for the target in the for loop is the
curve number. Quick background:
Each parent (that's a named entity in the data) is represented by tuples
in compList.
compList[0][16] is the total number of tuples for each parent
(compList[0][1].
I want to interate through all tuples for each parent in the 'for' loop.
The sequential number of the curves to be drawn for that parent is in
compList[0][5], and the curve name (used by the if/elif tests) is in
compList[0][4].
The behavior I want, in pseudocode is this:
For each parent:
hold plot axes until done
use curve #1 and call appropriate plotting function
increment curve number (which, I believe) the for loop does
automatically)
use next curve and call appropriate plotting function
when all plots for that parent are drawn ...
write plot to file
release plot axes for next parent
when done, stop
I tried adding a test for i < max, then issuing the continue command, but
that makes no difference. Obviously, I've missed the bus here. And I have
demonstrated no idea how this for loop should be constructed.
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